File: destructuringParameterDeclaration8.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (36 lines) | stat: -rw-r--r-- 2,024 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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration8.ts(4,5): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration8.ts(5,15): error TS2322: Type '"c"' is not assignable to type '"a" | "b"'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration8.ts(17,8): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'.
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration8.ts(18,8): error TS2322: Type '"one"' is not assignable to type '"x" | "y"'.


==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration8.ts (4 errors) ====
    // explicit type annotation should cause `method` to have type 'x' | 'y'
    // both inside and outside `test`.
    function test({
        method = 'z',
        ~~~~~~
!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'.
        nested: { p = 'c' }
                  ~
!!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'.
    }: {
        method?: 'x' | 'y',
        nested?: { p: 'a' | 'b' }
    })
    {
        method
        p
    }
    
    test({});
    test({ method: 'x', nested: { p: 'a' } })
    test({ method: 'z', nested: { p: 'b' } })
           ~~~~~~
!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'.
!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration8.ts:7:5: The expected type comes from property 'method' which is declared here on type '{ method?: "x" | "y"; nested?: { p: "a" | "b"; }; }'
    test({ method: 'one', nested: { p: 'a' } })
           ~~~~~~
!!! error TS2322: Type '"one"' is not assignable to type '"x" | "y"'.
!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration8.ts:7:5: The expected type comes from property 'method' which is declared here on type '{ method?: "x" | "y"; nested?: { p: "a" | "b"; }; }'