36 lines
2.2 KiB
Text
36 lines
2.2 KiB
Text
|
tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts(3,1): error TS2322: Type '(foo: number, bar: string) => boolean' is not assignable to type '((n: number, s: string) => number) | ((n: number, s: string) => string)'.
|
||
|
Type '(foo: number, bar: string) => boolean' is not assignable to type '(n: number, s: string) => string'.
|
||
|
Type 'boolean' is not assignable to type 'string'.
|
||
|
tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts(5,7): error TS2300: Duplicate identifier 'C'.
|
||
|
tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts(8,7): error TS2300: Duplicate identifier 'C'.
|
||
|
tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts(10,43): error TS2322: Type 'number' is not assignable to type 'T'.
|
||
|
tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts(10,50): error TS2322: Type 'number' is not assignable to type 'U'.
|
||
|
|
||
|
|
||
|
==== tests/cases/conformance/expressions/contextualTyping/functionExpressionContextualTyping2.ts (5 errors) ====
|
||
|
var g0: (n: number, s: string) => number
|
||
|
var i: typeof g0 | ((n: number, s: string) => string);
|
||
|
i = (foo, bar) => { return true; }
|
||
|
~
|
||
|
!!! error TS2322: Type '(foo: number, bar: string) => boolean' is not assignable to type '((n: number, s: string) => number) | ((n: number, s: string) => string)'.
|
||
|
!!! error TS2322: Type '(foo: number, bar: string) => boolean' is not assignable to type '(n: number, s: string) => string'.
|
||
|
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||
|
|
||
|
class C<T> { }
|
||
|
~
|
||
|
!!! error TS2300: Duplicate identifier 'C'.
|
||
|
|
||
|
var j: (c: C<Number>) => number = (j) => { return 1; }
|
||
|
class C<T, U> {
|
||
|
~
|
||
|
!!! error TS2300: Duplicate identifier 'C'.
|
||
|
constructor() {
|
||
|
var k: (j: T, k: U) => (T|U)[] = (j = 1, k = 0) => {
|
||
|
~~~~~
|
||
|
!!! error TS2322: Type 'number' is not assignable to type 'T'.
|
||
|
~~~~~
|
||
|
!!! error TS2322: Type 'number' is not assignable to type 'U'.
|
||
|
return [j, k];
|
||
|
}
|
||
|
}
|
||
|
}
|