Skip to content

Error on explicit any parameter with noImplicitAny enabled #12822

Description

@haizz

TypeScript Version: 2.1.4
Code

// compile with --noImplicitAny switch
function f1(props: any): any {
    return {
        a: [], 
        ...props
    };
}

function f2(data: any): void {
};

Expected behavior:

Code is compiled without errors.

Actual behavior:

8 function f2(data: any): void {
              ~~~~~~~~~

test.ts(8,13): error TS7006: Parameter 'data' implicitly has an 'any' type.

These variants are compiled fine for some weird reason:

function f1(props: any): any {
    return {
        a: 1, 
        ...props
    };
}

function f2(data: any): void {
};
function f1(props: any): any {
    return {
        a: [], 
    };
}

function f2(data: any): void {
};

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueHigh Priority

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions