Modernize toolchain: React 17, TypeScript 4.9, Node 16, and strict type fixes#320
Open
asuh wants to merge 3 commits intoetesync:masterfrom
Open
Modernize toolchain: React 17, TypeScript 4.9, Node 16, and strict type fixes#320asuh wants to merge 3 commits intoetesync:masterfrom
asuh wants to merge 3 commits intoetesync:masterfrom
Conversation
- Add .nvmrc pinned to Node 16 - Upgrade react and react-dom from ^16.13.1 to ^17.0.2 - Upgrade typescript from ~3.9.7 to ~4.9.5 - Upgrade @types/node from ^11.9.3 to ^16.0.0 - Upgrade @types/react from ^16.9.0 to ^17.0.0 - Upgrade @types/react-dom from ^16.9.0 to ^17.0.0 - Add resolutions for @types/react and @types/react-dom to prevent duplicate versions causing JSX component type conflicts Fix type errors introduced by stricter TypeScript 4.9 checks: - Cast Link as any in IconButton component prop (Collection.tsx, CollectionList.tsx) to work around MUI 4 typing limitations - Replace endDate getter override in TaskType with Object.defineProperty in constructor (pim-types.ts) since TS 4.9 disallows overriding a class property with an accessor - Wrap ExternalLink with React.forwardRef so MUI ButtonBase can attach refs when used as a component prop (ExternalLink.tsx)
- tsconfig.json: Remove deprecated suppressImplicitAnyIndexErrors option, add ignoreDeprecations: '6.0' for other legacy options - Add explicit Record<string, any> type annotations to object literals used with dynamic string keys: - CollectionEdit: colTypes - CollectionImport, CollectionList: collectionMap - ContactEdit, GroupEdit: collectionGroups, originalGroups, groups - Contacts/Toolbar, Tasks/Toolbar: transitionStyles (Record<string, React.CSSProperties>) - Debug: wantedEntries (Record<string, boolean>) - persist-state-history: stateCache - routes: RouteResolver.routes and constructor param - Cast dynamic state property access to (prevState as any)[name] in ContactEdit and GroupEdit (addValueType, removeValueType, handleValueTypeChange methods) - Cast zones.zones and zones.aliases to Record<string, any> in pim-types.ts timezoneLoadFromName for bracket notation access - Cast actions to Record<string, any> in store/reducers.ts for dynamic property access in fetchActions loop - Cast updatedOptions to Record<string, any> in RRule.tsx for dynamic key iteration and deletion; cast bysetpos and bymonthday to number[] for array element access - Add Record<string, any> constraint to insertSorted generic in helpers.tsx; cast self.state[part] for dynamic property access in handleInputChange - Replace theme.palette.primary[500] with theme.palette.primary.main in SearchableAddressBook and TaskList (Material-UI v4 best practice)
Contributor
Author
|
@tasn Hey, I hope this is helpful to incrementally migrate this project to a more modern stack. After this PR merges to master, there are multiple directions you could go:
I'll let you decide what makes sense. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades the core toolchain incrementally to more modern, supported versions and resolves all TypeScript strict type-checking errors introduced by the upgrade. Set up future upgrades to React 18 and 19. Bumps the project version to 0.7.0.
Changes
1. Upgrade React 17, TypeScript 4.9, and Node 16 baseline (
f865a22)reactandreact-domfrom ^16.13.1 to ^17.0.2typescriptfrom ~3.9.7 to ~4.9.5@types/nodeto ^16.0.0,@types/reactto ^17.0.0,@types/react-domto ^17.0.0resolutionsfor@types/reactand@types/react-domto prevent duplicate type versions causing JSX component type conflictsLinkasanyin MUIIconButtoncomponentprop (Collection.tsx,CollectionList.tsx)endDategetter override inTaskTypewithObject.definePropertyin constructor (pim-types.ts)ExternalLinkwithReact.forwardReffor MUIButtonBaseref forwarding (ExternalLink.tsx)2. Resolve TypeScript strict type-checking errors (
f8519a4)suppressImplicitAnyIndexErrorsfrom tsconfig.json, addignoreDeprecations: "6.0"Record<string, any>type annotations to object literals used with dynamic string keys across 17 filesContactEdit,GroupEdit)zones.zones/zones.aliasesfor bracket-notation access inpim-types.tstheme.palette.primary[500]withtheme.palette.primary.main(Material-UI v4 best practice)3. Bump to version 0.7.0 (
95b5dbb)Motivation
The previous toolchain (React 16, TypeScript 3.9, no Node version pinning) was outdated and made it difficult to adopt newer libraries or take advantage of improved type safety. These changes bring the project to a stable, maintained baseline while keeping the upgrade incremental and low-risk (no breaking API changes in React 16→17).
Testing
tsc(no type errors)