File: mappedTypeProperties.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (87 lines) | stat: -rw-r--r-- 4,530 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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(3,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(9,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(14,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(18,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(23,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(27,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(31,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(34,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(37,5): error TS7061: A mapped type may not declare properties or methods.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(40,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(40,6): error TS2304: Cannot find name 'P'.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(40,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(40,11): error TS2322: Type 'string' is not assignable to type 'object'.
tests/cases/conformance/types/mapped/mappedTypeProperties.ts(40,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.


==== tests/cases/conformance/types/mapped/mappedTypeProperties.ts (14 errors) ====
    export type PlaceType = 'openSky' | 'roofed' | 'garage'
    type Before = {
        model: 'hour' | 'day';
        ~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
        [placeType in PlaceType]: void;
    }
    
    type After = {
        [placeType in PlaceType]: void;
        model: 'hour' | 'day'
        ~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    
    type AfterQuestion = {
        [placeType in PlaceType]?: void;
        model: 'hour' | 'day';
        ~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    type AfterMethod = {
        [placeType in PlaceType]?: void;
        model(duration: number): 'hour' | 'day';
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    
    type AfterImplicit = {
        [placeType in PlaceType]
        model: 'hour' | 'day';
        ~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    type AfterImplicitQ = {
        [placeType in PlaceType]?
        model: 'hour' | 'day'
        ~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    
    interface I {
        [P in PlaceType]: any
        ~~~~~~~~~~~~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    class C {
        [P in PlaceType]: any
        ~~~~~~~~~~~~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    const D = class {
        [P in PlaceType]: any
        ~~~~~~~~~~~~~~~~
!!! error TS7061: A mapped type may not declare properties or methods.
    }
    const E = class {
        [P in 'a' | 'b']: any
        ~~~~~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
         ~
!!! error TS2304: Cannot find name 'P'.
         ~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
              ~~~
!!! error TS2322: Type 'string' is not assignable to type 'object'.
                    ~~~
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
    }