--- source: crates/oxc_codegen/tests/integration/main.rs snapshot_kind: text --- ########## 0 let x: string = `\x01`; ---------- let x: string = `\x01`; ########## 1 function foo(x: T, y: string, ...restOfParams: Omit): T { return x; } ---------- function foo(x: T, y: string, ...restOfParams: Omit): T { return x; } ########## 2 let x: string[] = ['abc', 'def', 'ghi']; ---------- let x: string[] = [ 'abc', 'def', 'ghi' ]; ########## 3 let x: Array = ['abc', 'def', 'ghi',]; ---------- let x: Array = [ 'abc', 'def', 'ghi' ]; ########## 4 let x: [string, number] = ['abc', 123]; ---------- let x: [string, number] = ['abc', 123]; ########## 5 let x: string | number = 'abc'; ---------- let x: string | number = 'abc'; ########## 6 let x: string & number = 'abc'; ---------- let x: string & number = 'abc'; ########## 7 let x: typeof String = 'string'; ---------- let x: typeof String = 'string'; ########## 8 let x: keyof string = 'length'; ---------- let x: keyof string = 'length'; ########## 9 let x: keyof typeof String = 'length'; ---------- let x: keyof typeof String = 'length'; ########## 10 let x: string['length'] = 123; ---------- let x: string['length'] = 123; ########## 11 function isString(value: unknown): asserts value is string { if (typeof value !== 'string') { throw new Error('Not a string'); } } ---------- function isString(value: unknown): asserts value is string { if (typeof value !== 'string') { throw new Error('Not a string'); } } ########## 12 import type { Foo } from 'foo'; ---------- import type { Foo } from 'foo'; ########## 13 import { Foo, type Bar } from 'foo'; ---------- import { Foo, type Bar } from 'foo'; ########## 14 export { Foo, type Bar } from 'foo'; ---------- export { Foo, type Bar } from 'foo'; ########## 15 type A = { [K in keyof T as K extends string ? B : K ]: T[K] } ---------- type A = { [K in keyof T as K extends string ? B : K] : T[K] }; ########## 16 class A {readonly type = 'frame'} ---------- class A { readonly type = 'frame'; } ########## 17 let foo: { (t: T): void } ---------- let foo: { (t: T): void }; ########## 18 let foo: { new (t: T): void } ---------- let foo: { new (t: T): void }; ########## 19 function (){} ---------- function() {} ########## 20 class A {m?(): void} ---------- class A { m?(): void; } ########## 21 class A {constructor(public readonly a: number) {}} ---------- class A { constructor(public readonly a: number) {} } ########## 22 abstract class A {private abstract static m() {}} ---------- abstract class A { private abstract static m() {} } ########## 23 abstract class A {private abstract static readonly prop: string} ---------- abstract class A { private abstract static readonly prop: string; } ########## 24 a = x!; ---------- a = x!; ########## 25 b = (x as y); ---------- b = x as y; ########## 26 c = foo; ---------- c = foo; ########## 27 d = x satisfies y; ---------- d = ((x) satisfies y); ########## 28 export @x declare abstract class C {} ---------- export @x declare abstract class C {} ########## 29 div`` ---------- div``; ########## 30 export type Component = Foo; ---------- export type Component = Foo; ########## 31 export type Component< Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record = {}, S extends Record = any, > = | ConcreteComponent | ComponentPublicInstanceConstructor ---------- export type Component< Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record = {}, S extends Record = any > = ConcreteComponent | ComponentPublicInstanceConstructor; ########## 32 (a || b) as any ---------- (a || b) as any; ########## 33 (a ** b) as any ---------- (a ** b) as any; ########## 34 (function g() {}) as any ---------- (function g() {}) as any; ########## 35 import defaultExport from "module-name"; import * as name from "module-name"; import { export1 } from "module-name"; import { export1 as alias1 } from "module-name"; import { default as alias } from "module-name"; import { export1, export2 } from "module-name"; import { export1, export2 as alias2, /* … */ } from "module-name"; import { "string name" as alias } from "module-name"; import defaultExport, { export1, /* … */ } from "module-name"; import defaultExport, * as name from "module-name"; import "module-name"; import {} from 'mod'; export let name1, name2/*, … */; // also var export const name3 = 1, name4 = 2/*, … */; // also var, let export function functionName() { /* … */ } export class ClassName { /* … */ } export function* generatorFunctionName() { /* … */ } export const { name5, name2: bar } = o; export const [ name6, name7 ] = array; export { name8, /* …, */ name81 }; export { variable1 as name9, variable2 as name10, /* …, */ name82 }; export { variable1 as "string name" }; export { name1 as default1 /*, … */ }; export * from "module-name"; export * as name11 from "module-name"; export { name12, /* …, */ nameN } from "module-name"; export { import1 as name13, import2 as name14, /* …, */ name15 } from "module-name"; export { default, /* …, */ } from "module-name"; export { default as name16 } from "module-name"; ---------- import defaultExport from 'module-name'; import * as name from 'module-name'; import { export1 } from 'module-name'; import { export1 as alias1 } from 'module-name'; import { default as alias } from 'module-name'; import { export1, export2 } from 'module-name'; import { export1, export2 as alias2 } from 'module-name'; import { 'string name' as alias } from 'module-name'; import defaultExport, { export1 } from 'module-name'; import defaultExport, * as name from 'module-name'; import 'module-name'; import {} from "mod"; export let name1, name2; export const name3 = 1, name4 = 2; export function functionName() {} export class ClassName {} export function* generatorFunctionName() {} export const { name5, name2: bar } = o; export const [name6, name7] = array; export { name8, name81 }; export { variable1 as name9, variable2 as name10, name82 }; export { variable1 as 'string name' }; export { name1 as default1 }; export * from 'module-name'; export * as name11 from 'module-name'; export { name12, nameN } from 'module-name'; export { import1 as name13, import2 as name14, name15 } from 'module-name'; export { default } from 'module-name'; export { default as name16 } from 'module-name';