Skip to content

Commit f40c5a8

Browse files
committed
fix: ignore type errors in generated files
This should be temporary to continue progress while we wait on a fix in orval
1 parent 9360fcf commit f40c5a8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

morph-query-keys.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Project, SyntaxKind } from 'ts-morph';
22

3+
const NO_CHECK_COMMENT = '// @ts-nocheck';
4+
35
const project = new Project({
46
tsConfigFilePath: './tsconfig.json',
57
skipAddingFilesFromTsConfig: true,
68
});
79

810
// Add all .ts files inside ./src (this includes index.ts, custom-instance.ts etc.)
9-
project.addSourceFilesAtPaths('./src/**/*.ts');
11+
project.addSourceFilesAtPaths(['./src/**/*.ts', '!./src/index.ts', '!./src/custom-instance.ts']);
1012

1113
// We will filter out all of the extra ones (index.ts, custom-instance.ts etc.) by the number of "/"
1214
// in the full file path. I.e. the ones we wan't to keep have one extra "/"
@@ -16,6 +18,11 @@ const maxParts = Math.max(...project.getSourceFiles().map(getNumberOfParts));
1618
const apiName = process.argv.at(-1); // ! probably requires a recent NodeJS version
1719

1820
for (const apiFile of project.getSourceFiles()) {
21+
const fullText = apiFile.getFullText();
22+
if (!fullText.includes(NO_CHECK_COMMENT)) {
23+
apiFile.insertStatements(0, NO_CHECK_COMMENT);
24+
}
25+
1926
if (getNumberOfParts(apiFile) === maxParts) {
2027
// get all variables used
2128
apiFile.getVariableStatements().forEach((variable) => {

setup-entrypoints.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tags.forEach((tag) => {
2222
);
2323
} catch (err) {
2424
console.log(
25-
`Not created a package.json for ${tag}. The folder might not have been created by orval.`,
25+
`Not created a package.json for ${tag}. The folder might not have been created by orval. This is usually ok.`,
2626
);
2727
console.error(err);
2828
}

0 commit comments

Comments
 (0)