File: genericChainedCalls.errors.txt

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (23 lines) | stat: -rw-r--r-- 989 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
tests/cases/compiler/genericChainedCalls.ts(8,29): error TS2339: Property 'length' does not exist on type 'number'.
tests/cases/compiler/genericChainedCalls.ts(12,29): error TS2339: Property 'length' does not exist on type 'number'.


==== tests/cases/compiler/genericChainedCalls.ts (2 errors) ====
    interface I1<T> {
        func<U>(callback: (value: T) => U): I1<T>;
    }
     
    declare var v1: I1<number>;
     
    var r1 = v1.func(num => num.toString()) 
               .func(str => str.length) // error, number doesn't have a length
                                ~~~~~~
!!! error TS2339: Property 'length' does not exist on type 'number'.
               .func(num => num.toString())
     
    var s1 = v1.func(num => num.toString()) 
    var s2 = s1.func(str => str.length) // should also error
                                ~~~~~~
!!! error TS2339: Property 'length' does not exist on type 'number'.
    var s3 = s2.func(num => num.toString())