Skip to content

Commit

Permalink
Merge pull request #651 from samchon/features/strict
Browse files Browse the repository at this point in the history
Enforce `strictNullChecks` to be true
  • Loading branch information
samchon authored Jun 9, 2023
2 parents e1fae7e + 4a9983f commit 7f627b7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typia",
"version": "4.0.3",
"version": "4.0.5",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-json/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-json",
"version": "4.0.3",
"version": "4.0.5",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -68,7 +68,7 @@
},
"homepage": "https://typia.io",
"dependencies": {
"typia": "4.0.3"
"typia": "4.0.5"
},
"peerDependencies": {
"typescript": ">= 4.5.2"
Expand Down
16 changes: 13 additions & 3 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@ import { ITransformOptions } from "./transformers/ITransformOptions";
export const transform = (
program: ts.Program,
options?: ITransformOptions,
): ts.TransformerFactory<ts.SourceFile> =>
FileTransformer.transform({
): ts.TransformerFactory<ts.SourceFile> => {
const compilerOptions: ts.CompilerOptions = program.getCompilerOptions();
const strict: boolean =
compilerOptions.strictNullChecks !== undefined
? !!compilerOptions.strictNullChecks
: !!compilerOptions.strict;
if (strict === false)
throw new Error(
`Error on "tsconfig.json": typia requires \`compilerOptions.strictNullChecks\` to be true.`,
);
return FileTransformer.transform({
program,
compilerOptions: program.getCompilerOptions(),
compilerOptions,
checker: program.getTypeChecker(),
printer: ts.createPrinter(),
options: options || {},
});
};
export default transform;

0 comments on commit 7f627b7

Please sign in to comment.