Skip to content

Commit

Permalink
fix: TransformOptions.tsconfigRaw cannot receive an object (#230)
Browse files Browse the repository at this point in the history
Previously this type was simplified to only accept a stringified version of the
tsconfig override. Now it also accepts a typed object.
  • Loading branch information
mrgrain authored Aug 22, 2022
1 parent 3dc7d92 commit 1584ece
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 4 deletions.
33 changes: 32 additions & 1 deletion .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,39 @@ new TypeScriptSourceFile(project, 'src/esbuild-types.ts', {
removeFromInterface('BuildOptions', ['entryPoints', 'stdin', 'plugins', 'watch']);
esbuildTypes.getInterface('CommonOptions')?.getProperty('mangleProps')?.setType('any');
esbuildTypes.getInterface('CommonOptions')?.getProperty('reserveProps')?.setType('any');
esbuildTypes.getInterface('TransformOptions')?.getProperty('tsconfigRaw')?.setType('string');
esbuildTypes.getInterface('InitializeOptions')?.getProperty('wasmModule')?.setType('any');

const compileOptions = esbuildTypes.addInterface({
name: 'CompilerOptions',
isExported: true,
properties: [
['jsxFactory', 'string'],
['jsxFragmentFactory', 'string'],
['useDefineForClassFields', 'boolean'],
['importsNotUsedAsValues', "'remove' | 'preserve' | 'error'"],
['preserveValueImports', 'boolean'],
].map(([name, type]) => ({
name,
isReadonly: true,
hasQuestionToken: true,
type,
})),
});
const tsconfigOptions = esbuildTypes.addInterface(
{
name: 'TsconfigOptions',
isExported: true,
properties: [{
name: 'compilerOptions',
isReadonly: true,
hasQuestionToken: true,
type: compileOptions.getName(),
}],
});
esbuildTypes
?.getInterface('TransformOptions')
?.getProperty('tsconfigRaw')
?.setType(`string | ${tsconfigOptions.getName()}`);
},
});

Expand Down
84 changes: 82 additions & 2 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion src/esbuild-types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
export {
BuildOptions,
TransformOptions,
TsconfigOptions,
CompilerOptions,
} from './esbuild-types';

export {
Expand Down

0 comments on commit 1584ece

Please sign in to comment.