fix(es/parser): Fix typeof in TSCallSignatureDeclaration (#6553)

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6430
This commit is contained in:
Alexander Akait 2022-11-30 20:09:53 +03:00 committed by GitHub
parent ad73fbfcd0
commit aa28aa0c7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1399 additions and 1 deletions

View File

@ -355,7 +355,7 @@ impl<I: Tokens> Parser<I> {
.map(From::from)? .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()?) Some(self.parse_ts_type_args()?)
} else { } else {
None None

View 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
}

File diff suppressed because it is too large Load Diff