File: functionSignatureAssignmentCompat1.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 (22 lines) | stat: -rw-r--r-- 1,179 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
tests/cases/compiler/functionSignatureAssignmentCompat1.ts(10,21): error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc'.
  Types of parameters 'delimiter' and 'eventEmitter' are incompatible.
    Type 'number' is not assignable to type 'string'.


==== tests/cases/compiler/functionSignatureAssignmentCompat1.ts (1 errors) ====
    interface ParserFunc {
        (eventEmitter: number, buffer: string): void;
    }
    interface Parsers {
        raw: ParserFunc;
        readline(delimiter?: string): ParserFunc;
    }
    var parsers: Parsers;
    var c: ParserFunc = parsers.raw; // ok!
    var d: ParserFunc = parsers.readline; // not ok
                        ~~~~~~~~~~~~~~~~
!!! error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc'.
!!! error TS2322:   Types of parameters 'delimiter' and 'eventEmitter' are incompatible.
!!! error TS2322:     Type 'number' is not assignable to type 'string'.
!!! related TS6212 tests/cases/compiler/functionSignatureAssignmentCompat1.ts:10:21: Did you mean to call this expression?
    var e: ParserFunc = parsers.readline(); // ok