Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Aug 12, 2024
1 parent 3e1125c commit 18496bc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/babel-generator/src/generators/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export function TSIndexedAccessType(
}

export function TSMappedType(this: Printer, node: t.TSMappedType) {
const { nameType, optional, readonly, typeParameter, typeAnnotation } = node;
const { nameType, optional, readonly, typeAnnotation } = node;
this.token("{");
this.space();
if (readonly) {
Expand All @@ -424,20 +424,22 @@ export function TSMappedType(this: Printer, node: t.TSMappedType) {

this.token("[");
if (process.env.BABEL_8_BREAKING) {
// @ts-expect-error Babel 8 AST shape
// @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape
this.word(node.key.name);
} else {
this.word(typeParameter.name);
// @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape
this.word(node.typeParameter.name);
}

this.space();
this.word("in");
this.space();
if (process.env.BABEL_8_BREAKING) {
// @ts-expect-error Babel 8 AST shape
// @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape
this.print(node.constraint, node);
} else {
this.print(typeParameter.constraint, typeParameter);
// @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape
this.print(node.typeParameter.constraint, node.typeParameter);
}

if (nameType) {
Expand Down

0 comments on commit 18496bc

Please sign in to comment.