diff --git a/test/index.test.js b/test/index.test.js index 3424c4a16..16e429c9c 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -275,3 +275,20 @@ if(!(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( }`; assert.doesNotThrow(() => transformSync(source)); }); + +test("should handle advanced type-level constructs", (t) => { + const inputCode = ` + type Fn = (x: string) => number; + + type ReturnType = T extends (...args: any) => infer R ? R : never; + + type X = ReturnType; + + type Props = { id: string; name: string }; + type Keys = keyof Props; + + type A = typeof Math; + `; + const { code } = transformSync(inputCode); + t.assert.snapshot(code); +}); diff --git a/test/snapshots/index.test.js.snapshot b/test/snapshots/index.test.js.snapshot index f3661abd7..a2bb101ea 100644 --- a/test/snapshots/index.test.js.snapshot +++ b/test/snapshots/index.test.js.snapshot @@ -18,6 +18,10 @@ exports[`should handle User type and isAdult function 1`] = ` "\\n \\n \\n \\n \\n\\n function isAdult(user ) {\\n return user.age >= 18;\\n }\\n " `; +exports[`should handle advanced type-level constructs 1`] = ` +"\\n\\t\\t \\n\\n\\t\\t \\n\\n\\t\\t \\n\\n\\t\\t \\n\\t\\t \\n\\n\\t\\t \\n\\t" +`; + exports[`should handle class modifiers 1`] = ` "\\n\\t\\tclass PrivateConstructor {\\n\\t\\t constructor() {}\\n\\t\\t a() {}\\n\\t\\t b() {}\\n\\t\\t static create() {\\n\\t\\t return new PrivateConstructor()\\n\\t\\t }\\n\\t\\t}\\n\\n\\t\\tconst ins = PrivateConstructor.create()\\n\\t\\tconsole.log(ins)\\n\\t" `;