From 31106806149195ec9b9766d86824bd8336acd167 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com> Date: Tue, 4 Jun 2024 08:12:12 +0200 Subject: [PATCH] Improve TS built-in types (#24) # Make TS stricter ## :recycle: Current situation & Problem TypeScript types for standard lib have couple decisions that could be better. One of them is `any` return type from `JSON.parse` and `res.json()`. ## :gear: Release Notes * Improve TS built-in types ## :books: Documentation `reset.d.ts` fixes them all making TS code more safe and more pleasant to work with. See [rules](https://www.totaltypescript.com/ts-reset) for all the changes. ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md). --- package-lock.json | 7 +++++++ package.json | 1 + reset.d.ts | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 reset.d.ts diff --git a/package-lock.json b/package-lock.json index f3f66a7..c762377 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "devDependencies": { "@testing-library/jest-dom": "^6", "@testing-library/react": "^15", + "@total-typescript/ts-reset": "^0.5.1", "@types/jest": "^29", "@types/node": "^20", "@types/react": "^18", @@ -2325,6 +2326,12 @@ "node": ">= 10" } }, + "node_modules/@total-typescript/ts-reset": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@total-typescript/ts-reset/-/ts-reset-0.5.1.tgz", + "integrity": "sha512-AqlrT8YA1o7Ff5wPfMOL0pvL+1X+sw60NN6CcOCqs658emD6RfiXhF7Gu9QcfKBH7ELY2nInLhKSCWVoNL70MQ==", + "dev": true + }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", diff --git a/package.json b/package.json index 0e11109..02bb931 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "devDependencies": { "@testing-library/jest-dom": "^6", "@testing-library/react": "^15", + "@total-typescript/ts-reset": "^0.5.1", "@types/jest": "^29", "@types/node": "^20", "@types/react": "^18", diff --git a/reset.d.ts b/reset.d.ts new file mode 100644 index 0000000..ef18f27 --- /dev/null +++ b/reset.d.ts @@ -0,0 +1,10 @@ +// +// This source file is part of the Stanford Biodesign Digital Health Next.js Template open-source project +// +// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + +// Do not add any other lines of code to this file! +import '@total-typescript/ts-reset'