Skip to content

Commit

Permalink
Merge pull request #902 from mobu-of-the-world/ts5
Browse files Browse the repository at this point in the history
Migrate to TypeScript 5 🎉
  • Loading branch information
kachick authored Apr 17, 2023
2 parents d635801 + d4394bb commit 6e7887e
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ rules:
- selector: TSEnumDeclaration
message: >-
Don't declare enums. ref: https://www.kabuku.co.jp/developers/good-bye-typescript-enum
# See https://zenn.dev/teppeis/articles/2023-04-typescript-5_0-verbatim-module-syntax for enabling reason
'@typescript-eslint/consistent-type-imports': 'error'
'@typescript-eslint/no-import-type-side-effects': 'error'
overrides:
- files:
- src/**/*.ts
Expand Down
29 changes: 8 additions & 21 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"devDependencies": {
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@tsconfig/node18-strictest-esm": "1.0.1",
"@types/node": "18.15.11",
"@types/react": "18.0.37",
"@types/react-dom": "18.0.11",
Expand All @@ -25,7 +24,7 @@
"eslint-plugin-react-hooks": "4.6.0",
"ts-node-test": "0.4.1",
"tsx": "3.12.6",
"typescript": "4.9.5",
"typescript": "5.0.4",
"vite": "4.2.1"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/common/usersContexts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, ReactElement, useContext, useState } from "react";
import { createContext, type ReactElement, useContext, useState } from "react";
import { getStorageUsers, setStorageUsers } from "./storage";

const usersContext = createContext<string[]>([]);
Expand Down
2 changes: 1 addition & 1 deletion src/session/Interval.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeEvent, useCallback } from "react";
import { type ChangeEvent, useCallback } from "react";

import TextInput from "../common/TextInput";

Expand Down
30 changes: 30 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// Import from https://github.com/tsconfig/bases/commit/0ae4791797d8ba3dd2bca9aca880eb2d3e30e6fb
// To avoid issues around tsconfig.extends array
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 18 + ESM + Strictest",
"compilerOptions": {
"lib": [
"es2022"
],
"module": "es2022",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"verbatimModuleSyntax": true,
"checkJs": true
}
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": "@tsconfig/node18-strictest-esm/tsconfig.json",
// TODO: Use tsconfig/base after all tools support tsconfig.extends array
"extends": "./tsconfig.base.json",
"compilerOptions": {
// https://www.typescriptlang.org/docs/handbook/esm-node.html
"module": "node16",
Expand Down

0 comments on commit 6e7887e

Please sign in to comment.