20 lines
No EOL
906 B
Text
20 lines
No EOL
906 B
Text
tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticMemberAssignsToConstructorFunctionMembers.ts(7,9): error TS2322: Type '() => void' is not assignable to type '(x: number) => number':
|
|
Type 'void' is not assignable to type 'number'.
|
|
|
|
|
|
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticMemberAssignsToConstructorFunctionMembers.ts (1 errors) ====
|
|
class C {
|
|
static foo() {
|
|
C.foo = () => { }
|
|
}
|
|
|
|
static bar(x: number): number {
|
|
C.bar = () => { } // error
|
|
~~~~~
|
|
!!! error TS2322: Type '() => void' is not assignable to type '(x: number) => number':
|
|
!!! error TS2322: Type 'void' is not assignable to type 'number'.
|
|
C.bar = (x) => x; // ok
|
|
C.bar = (x: number) => 1; // ok
|
|
return 1;
|
|
}
|
|
} |