File: nonPrimitiveConstraintOfIndexAccessType.errors.txt

package info (click to toggle)
node-typescript 4.8.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 523,068 kB
  • sloc: javascript: 1,735,777; makefile: 7; sh: 1
file content (67 lines) | stat: -rw-r--r-- 3,688 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(3,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(6,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(9,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(12,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(15,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
  Type 'string' is not assignable to type 'never'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(18,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(24,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(27,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(30,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.


==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts (10 errors) ====
    // test for #15371
    function f<T extends object, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function g<T extends null, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function h<T extends undefined, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function i<T extends void, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function j<T extends never, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
!!! error TS2322:   Type 'string' is not assignable to type 'never'.
    }
    function k<T extends number, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function o<T extends string, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function m<T extends { a: number }, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }
    function n<T extends { [s: string]: number }, P extends keyof T>(s: string, tp: T[P]): void {
        tp = s;
        ~~
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
    }