Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
strict tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT committed Sep 30, 2023
1 parent d1d47fa commit 9d119b4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"devDependencies": {
"@release-it/conventional-changelog": "^7.0.2",
"@tsconfig/strictest": "^2.0.2",
"@types/eslint": "^8.44.3",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

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

7 changes: 6 additions & 1 deletion src/tson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export function tsonDeserializer(opts: TsonOptions): TsonDeserializeFn {

for (const handler of opts.types) {
if (handler.key) {
if (typeByKey[handler.key]) {
throw new Error(`Multiple handlers for key ${handler.key} found`);
}

typeByKey[handler.key] =
handler as AnyTsonTransformerSerializeDeserialize;
}
Expand All @@ -42,7 +46,8 @@ export function tsonDeserializer(opts: TsonOptions): TsonDeserializeFn {
const walk: WalkFn = (value) => {
if (isTsonTuple(value, nonce)) {
const [type, serializedValue] = value;
const transformer = typeByKey[type];
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const transformer = typeByKey[type]!;
return transformer.deserialize(walk(serializedValue));
}

Expand Down
14 changes: 1 addition & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "lib",
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ES2022"
},
"extends": "@tsconfig/strictest/tsconfig.json",
"include": ["src"]
}

0 comments on commit 9d119b4

Please sign in to comment.