File: defaultBestCommonTypesHaveDecls.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 (29 lines) | stat: -rw-r--r-- 1,526 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(2,6): error TS2339: Property 'length' does not exist on type '{}'.
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(5,6): error TS2339: Property 'length' does not exist on type 'Object'.
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
  Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.


==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (3 errors) ====
    var obj1: {};
    obj1.length;
         ~~~~~~
!!! error TS2339: Property 'length' does not exist on type '{}'.
    
    var obj2: Object;
    obj2.length;
         ~~~~~~
!!! error TS2339: Property 'length' does not exist on type 'Object'.
    
    function concat<T>(x: T, y: T): T { return null; }
    var result = concat(1, ""); // error
                 ~~~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453:   Type argument candidate '1' is not a valid type argument because it is not a supertype of candidate '""'.
    var elementCount = result.length; 
    
    function concat2<T, U>(x: T, y: U) { return null; }
    var result2 = concat2(1, ""); // result2 will be number|string
    var elementCount2 = result.length;