Skip to content

Commit

Permalink
fix: better type alias in navbar patching
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Jun 10, 2023
1 parent 7e27619 commit 55f4aac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions typescript/src/getPatchedNavTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const getPatchedNavModule = (additionalFeatures: AdditionalFeatures): { getNavig
// transform?: (found: string, content: string, position: number) => [string?, string?]
}
const addChildrenRecursivelySwitchFirstCase = ['function addChildrenRecursively(node)', 'switch (node.kind)']
const typeAliasCaseNeedle = [...addChildrenRecursivelySwitchFirstCase, 'TypeAliasDeclaration */']

const patchLocations: PatchLocation[] = [
{
Expand All @@ -44,7 +45,7 @@ const getPatchedNavModule = (additionalFeatures: AdditionalFeatures): { getNavig
break;`,
},
{
searchString: 'case 262 /* SyntaxKind.TypeAliasDeclaration */',
searchString: typeAliasCaseNeedle,
linesOffset: 3,
// https://github.com/microsoft/TypeScript/pull/52558/
addString: /* js */ `
Expand All @@ -54,7 +55,7 @@ const getPatchedNavModule = (additionalFeatures: AdditionalFeatures): { getNavig
`,
},
{
searchString: 'case 262 /* SyntaxKind.TypeAliasDeclaration */',
searchString: typeAliasCaseNeedle,
linesOffset: 0,
removeLines: 1,
},
Expand Down

0 comments on commit 55f4aac

Please sign in to comment.