Files
tsgo/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration8.errors.txt

36 lines
1.8 KiB
Plaintext

destructuringParameterDeclaration8.ts(4,5): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'.
destructuringParameterDeclaration8.ts(5,15): error TS2339: Property 'p' does not exist on type '{ p: "a" | "b"; } | undefined'.
destructuringParameterDeclaration8.ts(17,8): error TS2322: Type '"z"' is not assignable to type '"x" | "y" | undefined'.
destructuringParameterDeclaration8.ts(18,8): error TS2322: Type '"one"' is not assignable to type '"x" | "y" | undefined'.
==== 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 TS2339: Property 'p' does not exist on type '{ p: "a" | "b"; } | undefined'.
}: {
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" | undefined'.
!!! related TS6500 destructuringParameterDeclaration8.ts:7:5: The expected type comes from property 'method' which is declared here on type '{ method?: "x" | "y" | undefined; nested?: { p: "a" | "b"; } | undefined; }'
test({ method: 'one', nested: { p: 'a' } })
~~~~~~
!!! error TS2322: Type '"one"' is not assignable to type '"x" | "y" | undefined'.
!!! related TS6500 destructuringParameterDeclaration8.ts:7:5: The expected type comes from property 'method' which is declared here on type '{ method?: "x" | "y" | undefined; nested?: { p: "a" | "b"; } | undefined; }'