File: typeArgumentInferenceWithClassExpression2.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression2.ts(6,5): error TS2345: Argument of type 'typeof (Anonymous class)' is not assignable to parameter of type 'typeof (Anonymous class)'.
  Type '(Anonymous class)' is not assignable to type 'foo<{}>.(Anonymous class)'.
    Property 'prop' is missing in type '(Anonymous class)'.


==== tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression2.ts (1 errors) ====
    function foo<T>(x = class { prop: T }): T {
        return undefined;
    }
    
    // Should not infer string because it is a static property
    foo(class { static prop = "hello" }).length;
        ~~~~~
!!! error TS2345: Argument of type 'typeof (Anonymous class)' is not assignable to parameter of type 'typeof (Anonymous class)'.
!!! error TS2345:   Type '(Anonymous class)' is not assignable to type 'foo<{}>.(Anonymous class)'.
!!! error TS2345:     Property 'prop' is missing in type '(Anonymous class)'.