Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Sep 26, 2023
1 parent f63a53a commit 3af020a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/preprocessors/preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function preprocessor(code: string, options: PrettierOptions): string {
traverse(ast, {
ImportDeclaration(path: NodePath<ImportDeclaration>) {
const tsModuleParent = path.findParent((p) =>
isTSModuleDeclaration(p),
isTSModuleDeclaration(p.node),
);
if (!tsModuleParent) {
allOriginalImportNodes.push(path.node);
Expand Down
6 changes: 4 additions & 2 deletions src/utils/get-code-from-ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ export const getCodeFromAst = ({
start: 0,
end: 0,
loc: {
start: { line: 0, column: 0 },
end: { line: 0, column: 0 },
start: { line: 0, column: 0, index: 0 },
end: { line: 0, column: 0, index: 0 },
filename: '',
identifierName: '',
},
});

Expand Down
8 changes: 6 additions & 2 deletions src/utils/get-comment-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ export function attachCommentsToOutputNodes(
...firstImport.loc?.end,
line: firstImport.loc?.end.line + commentHeight,
},
filename: '',
identifierName: ''
};

const moveDist =
Expand Down Expand Up @@ -536,8 +538,10 @@ function ensureEmptyStatementAtFront(outputNodes: ImportOrLine[]) {
}
const dummy = emptyStatement();
dummy.loc = {
start: { line: 0, column: 0 },
end: { line: 0, column: 0 },
start: { line: 0, column: 0, index: 0 },
end: { line: 0, column: 0, index: 0 },
filename: '',
identifierName: '',
};
outputNodes.unshift(dummy);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/get-import-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const getImportNodes = (
traverse(ast, {
ImportDeclaration(path: NodePath<ImportDeclaration>) {
const tsModuleParent = path.findParent((p) =>
isTSModuleDeclaration(p),
isTSModuleDeclaration(p.node),
);
if (!tsModuleParent) {
importNodes.push(path.node);
Expand Down

0 comments on commit 3af020a

Please sign in to comment.