File: functionSignatureAssignmentCompat1.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 (21 lines) | stat: -rw-r--r-- 1,023 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
tests/cases/compiler/functionSignatureAssignmentCompat1.ts(10,5): 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'.
    var e: ParserFunc = parsers.readline(); // ok