Skip to content

Commit

Permalink
chore: definitely fix typescript perf
Browse files Browse the repository at this point in the history
  • Loading branch information
DTrombett committed May 20, 2023
1 parent 9a632ae commit 6f3c6dc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "A library to interact with the api of ArgoScuolaNext",
"exports": "./dist/index.js",
"main": "./dist/index.js",
"types": "./src/index.ts",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsup",
"build": "tsup --dts",
"lint": "eslint src --fix",
"prettier": "prettier --write src/**/*.ts",
"start": "npm run build && node --trace-warnings --enable-source-maps .",
Expand Down
12 changes: 6 additions & 6 deletions src/structures/Tassa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export class Tassa extends Base<TassaData> {
if (this.isJson(data)) {
this.handleJson(data);
this.dataCreazione =
data.dataCreazione === undefined
? undefined
: new Date(data.dataCreazione);
typeof data.dataCreazione === "string"
? new Date(data.dataCreazione)
: undefined;
this.dataPagamento =
data.dataPagamento === undefined
? undefined
: new Date(data.dataPagamento);
typeof data.dataPagamento === "string"
? new Date(data.dataPagamento)
: undefined;
this.scadenza = new Date(data.scadenza);
} else {
if (data.dataCreazione != null)
Expand Down
13 changes: 7 additions & 6 deletions src/types/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ export type ClientOptions = Partial<
} | null;
}
>;
export type Jsonify<T, D extends boolean = true> = D extends true
? T extends {
toJSON(): infer J;
}
? Jsonify<J, false>
: Jsonify<T, false>
export type Jsonify<T, D extends boolean = true> = [D, T] extends [
true,
{
toJSON(): infer J;
}
]
? Jsonify<J, false>
: T extends boolean | number | string | null
? T
: T extends bigint
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"alwaysStrict": true,
"composite": true,
"esModuleInterop": true,
"isolatedModules": true,
"module": "ESNext",
Expand Down

0 comments on commit 6f3c6dc

Please sign in to comment.