Skip to content

Commit

Permalink
feat: add more type checking compiler options (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored May 23, 2023
1 parent bcc8744 commit 7fed907
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ export interface BuildOptions {
* @default false
*/
importHelpers?: boolean;
strictBindCallApply?: boolean;
strictFunctionTypes?: boolean;
strictNullChecks?: boolean;
strictPropertyInitialization?: boolean;
noImplicitAny?: boolean;
noImplicitReturns?: boolean;
noImplicitThis?: boolean;
noStrictGenericChecks?: boolean;
noUncheckedIndexedAccess?: boolean;
target?: ScriptTarget;
/**
* Use source maps from the canonical typescript to ESM/CommonJS emit.
Expand All @@ -152,6 +161,7 @@ export interface BuildOptions {
* @default false
*/
emitDecoratorMetadata?: boolean;
useUnknownInCatchVariables?: boolean;
};
/** Action to do after emitting and before running tests. */
postBuild?: () => void | Promise<void>;
Expand Down Expand Up @@ -237,17 +247,20 @@ export async function build(options: BuildOptions): Promise<void> {
allowJs: true,
alwaysStrict: true,
stripInternal: true,
strictBindCallApply: true,
strictFunctionTypes: true,
strictNullChecks: true,
strictPropertyInitialization: true,
strictBindCallApply: options.compilerOptions?.strictBindCallApply ?? true,
strictFunctionTypes: options.compilerOptions?.strictFunctionTypes ?? true,
strictNullChecks: options.compilerOptions?.strictNullChecks ?? true,
strictPropertyInitialization:
options.compilerOptions?.strictPropertyInitialization ?? true,
suppressExcessPropertyErrors: false,
suppressImplicitAnyIndexErrors: false,
noImplicitAny: true,
noImplicitReturns: false,
noImplicitThis: true,
noStrictGenericChecks: false,
noUncheckedIndexedAccess: false,
noImplicitAny: options.compilerOptions?.noImplicitAny ?? true,
noImplicitReturns: options.compilerOptions?.noImplicitReturns ?? false,
noImplicitThis: options.compilerOptions?.noImplicitThis ?? true,
noStrictGenericChecks: options.compilerOptions?.noStrictGenericChecks ??
false,
noUncheckedIndexedAccess:
options.compilerOptions?.noUncheckedIndexedAccess ?? false,
declaration: !!options.declaration,
esModuleInterop: false,
isolatedModules: true,
Expand All @@ -270,6 +283,8 @@ export async function build(options: BuildOptions): Promise<void> {
...getCompilerSourceMapOptions(options.compilerOptions?.sourceMap),
inlineSources: options.compilerOptions?.inlineSources,
skipLibCheck: options.compilerOptions?.skipLibCheck ?? true,
useUnknownInCatchVariables:
options.compilerOptions?.useUnknownInCatchVariables ?? false,
},
});

Expand Down

0 comments on commit 7fed907

Please sign in to comment.