@@ -4,17 +4,19 @@ import * as assert from 'assert';
44describe ( 'template literal types' , ( ) => {
55 describe ( 'union types' , ( ) => {
66 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 ) )
99 } )
1010
1111 describe ( 'primitives' , ( ) => {
1212 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 ) )
1515 } )
1616
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+ )
1921 )
2022} )
0 commit comments