Skip to content

Commit 305b615

Browse files
author
chenzhilin
committed
test(dts-test): fix directive dts test
1 parent f07c605 commit 305b615

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

packages-private/dts-test/directives.test-d.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,45 @@ describe('custom', () => {
3636
value: number
3737
oldValue: number | null
3838
arg?: 'Arg'
39-
modifiers: Partial<Record<'a' | 'b', boolean>>
39+
modifiers: Record<'a' | 'b', boolean>
40+
// @ts-expect-error
4041
}>(testDirective<number, 'a', 'Arg'>())
4142

4243
expectType<{
4344
value: number
4445
oldValue: number | null
4546
arg?: 'Arg'
4647
modifiers: Partial<Record<'a' | 'b', boolean>>
47-
}>(testDirective<number, 'a' | 'b', 'Arg'>())
48+
// @ts-expect-error
49+
}>(testDirective<number, 'a' | 'b', 'Argx'>())
4850

4951
expectType<{
5052
value: number
5153
oldValue: number | null
5254
arg?: 'Arg'
5355
modifiers: Partial<Record<'a' | 'b', boolean>>
54-
}>(testDirective<number, 'a' | 'b', 'Arg'>())
56+
// @ts-expect-error
57+
}>(testDirective<string, 'a' | 'b', 'Arg'>())
5558

5659
expectType<{
5760
value: number
5861
oldValue: number | null
5962
arg?: HTMLElement
6063
modifiers: Partial<Record<'a' | 'b', boolean>>
6164
}>(testDirective<number, 'a' | 'b', HTMLElement>())
65+
66+
expectType<{
67+
value: number
68+
oldValue: number | null
69+
arg?: HTMLElement
70+
modifiers: Partial<Record<'a' | 'b', boolean>>
71+
// @ts-expect-error
72+
}>(testDirective<number, 'a' | 'b', string>())
73+
74+
expectType<{
75+
value: number
76+
oldValue: number | null
77+
arg?: HTMLElement
78+
modifiers: Partial<Record<'a' | 'b', boolean>>
79+
}>(testDirective<number, 'a' | 'b'>())
6280
})

0 commit comments

Comments
 (0)