@@ -4,17 +4,19 @@ import * as assert from 'assert';
4
4
describe ( 'template literal types' , ( ) => {
5
5
describe ( 'union types' , ( ) => {
6
6
type Foo = `foo${'bar' | 'baz' } `
7
- it ( 'true' , ( ) => assert ( is < Foo > ( 'foobar' ) ) )
8
- it ( 'false' , ( ) => assert ( ! is < Foo > ( 'barbaz' ) ) )
7
+ it ( 'true' , ( ) => assert . deepStrictEqual ( is < Foo > ( 'foobar' ) , true ) )
8
+ it ( 'false' , ( ) => assert . deepStrictEqual ( is < Foo > ( 'barbaz' ) , false ) )
9
9
} )
10
10
11
11
describe ( 'primitives' , ( ) => {
12
12
type Foo = `foo${string } bar${number } `
13
- it ( 'true' , ( ) => assert ( is < Foo > ( 'foobazbar123' ) ) )
14
- it ( 'false' , ( ) => assert ( ! is < Foo > ( 'foobazbar123qux' ) ) ) // TODO: figure out why this one causes a stack overflow when using assertType
13
+ it ( 'true' , ( ) => assert . deepStrictEqual ( is < Foo > ( 'foobazbar123' ) , true ) )
14
+ it ( 'false' , ( ) => assert . deepStrictEqual ( is < Foo > ( 'foobazbar123qux' ) , false ) )
15
15
} )
16
16
17
- it ( 'buncha stuff' , ( ) =>
18
- assert ( is < `foo${string } ${number } bar${1 | 2 | 3 } baz${number } asdf`> ( 'foobar1bar2baz123asdf' ) )
17
+ it ( 'unions and primitives' , ( ) =>
18
+ assert . deepStrictEqual (
19
+ is < `foo${string } ${number } bar${1 | 2 | 3 } baz${number } asdf`> ( 'foobar1bar2baz123asdf' ) , true
20
+ )
19
21
)
20
22
} )
0 commit comments