-
-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(parser): add
Lexer::consume_2_chars
- Loading branch information
1 parent
ddd54af
commit 8db8095
Showing
6 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
crates/oxc_codegen/tests/integration/snapshots/ts.snap.new
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
source: crates/oxc_codegen/tests/integration/ts.rs | ||
assertion_line: 47 | ||
--- | ||
let x: string = `\x01`; | ||
let x: string = `\x01`; | ||
|
||
function foo<T extends string>(x: T, y: string, ...restOfParams: Omit<T, 'x'>): T { | ||
return x; | ||
} | ||
|
||
let x: string[] = ['abc', 'def', 'ghi']; | ||
let x: string[] = ['abc', 'def', 'ghi']; | ||
|
||
let x: Array<string> = ['abc', 'def', 'ghi',]; | ||
let x: Array<string> = ['abc', 'def', 'ghi',]; | ||
|
||
let x: [string, number] = ['abc', 123]; | ||
let x: [string, number] = ['abc', 123]; | ||
|
||
let x: string | number = 'abc'; | ||
let x: string | number = 'abc'; | ||
|
||
let x: string & number = 'abc'; | ||
let x: string & number = 'abc'; | ||
|
||
let x: typeof String = 'string'; | ||
let x: typeof String = 'string'; | ||
|
||
let x: keyof string = 'length'; | ||
let x: keyof string = 'length'; | ||
|
||
let x: keyof typeof String = 'length'; | ||
let x: keyof typeof String = 'length'; | ||
|
||
let x: string['length'] = 123; | ||
let x: string['length'] = 123; | ||
|
||
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'); | ||
} | ||
} | ||
|
||
import type { Foo } from 'foo'; | ||
import type { Foo } from 'foo'; | ||
|
||
import { Foo, type Bar } from 'foo'; | ||
import { Foo, type Bar } from 'foo'; | ||
|
||
export { Foo, type Bar } from 'foo'; | ||
export { Foo, type Bar } from 'foo'; | ||
|
||
type A<T> = { [K in keyof T as K extends string ? B<K> : K ]: T[K] } | ||
type A<T> = { [K in keyof T as K extends string ? B<K> : K] : T[K]}; | ||
|
||
class A {readonly type = 'frame'} | ||
class A { | ||
readonly type = 'frame'; | ||
} | ||
|
||
let foo: { <T>(t: T): void } | ||
let foo: {<T>(t: T): void}; | ||
|
||
let foo: { new <T>(t: T): void } | ||
let foo: {new <T>(t: T): void}; | ||
|
||
function <const T>(){} | ||
function<const T>() {} | ||
|
||
class A {m?(): void} | ||
class A { | ||
m?(): void; | ||
} | ||
|
||
class A {constructor(public readonly a: number) {}} | ||
class A { | ||
constructor(public readonly a: number) {} | ||
} | ||
|
||
abstract class A {private abstract static m() {}} | ||
abstract class A { | ||
private abstract static m() {} | ||
} | ||
|
||
abstract class A {private abstract static readonly prop: string} | ||
abstract class A { | ||
private abstract static readonly prop: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters