mirror of
https://github.com/swc-project/swc.git
synced 2024-12-26 07:02:28 +03:00
fix(es/parser): Fix typeof
in TSCallSignatureDeclaration
(#6553)
**Related issue:** - Closes https://github.com/swc-project/swc/issues/6430
This commit is contained in:
parent
ad73fbfcd0
commit
aa28aa0c7f
@ -355,7 +355,7 @@ impl<I: Tokens> Parser<I> {
|
||||
.map(From::from)?
|
||||
};
|
||||
|
||||
let type_args = if is!(self, '<') {
|
||||
let type_args = if !self.input.had_line_break_before_cur() && is!(self, '<') {
|
||||
Some(self.parse_ts_type_args()?)
|
||||
} else {
|
||||
None
|
||||
|
31
crates/swc_ecma_parser/tests/typescript/issue-6430/index.ts
Normal file
31
crates/swc_ecma_parser/tests/typescript/issue-6430/index.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import MyType from "../../../../swc_ecma_transforms_base/tests/ts-resolver/1/input";
|
||||
|
||||
type Tmpz = {
|
||||
<N extends number>(num: N): MyType
|
||||
<S extends string>(str: S): MyType
|
||||
}
|
||||
|
||||
type Tmp = {
|
||||
<N extends number>(num: N): typeof num
|
||||
<S extends string>(str: S): typeof str
|
||||
}
|
||||
|
||||
const foo: Tmp = <T,>(str: T): T => {
|
||||
return str;
|
||||
}
|
||||
|
||||
console.log(foo("str"));
|
||||
|
||||
type Tmp1 = {
|
||||
<S extends string>(str: S): typeof str
|
||||
}
|
||||
|
||||
type Tmp2 = {
|
||||
(num: number): number
|
||||
(str: string): string
|
||||
}
|
||||
|
||||
type Tmp3 = {
|
||||
<N extends number>(num: N): number
|
||||
<S extends string>(str: S): string
|
||||
}
|
1367
crates/swc_ecma_parser/tests/typescript/issue-6430/index.ts.json
Normal file
1367
crates/swc_ecma_parser/tests/typescript/issue-6430/index.ts.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user