Upgrading a react typescript project from defencedigital 2.80 to 3.30 #3164
Replies: 4 comments 10 replies
-
Just renaming Tab to TabSet has sorted one of the errors. Now working on the BUTTON_SIZE one. |
Beta Was this translation helpful? Give feedback.
-
That was easy too just change the constant no longer exists just use size="small" |
Beta Was this translation helpful? Give feedback.
-
ChangeEvent one looks tricky I have code that does this.
|
Beta Was this translation helpful? Give feedback.
-
The type that is causing the problem is value={formData.justification || ''} which is defined in the class as interface FormData { |
Beta Was this translation helpful? Give feedback.
-
Upgrading a react typescript project from defencedigital 2.80 to 3.30
Hi,
All help greately appreciated.
If I can sort all these out an use the latest version it will be very nice. If not I will have to abort the branch and carry on with 2.80.
Best regards,
Richard
I have these in my package json after upgrading from 2.80
"@defencedigital/css-framework": "^2.80.3",
"@defencedigital/design-tokens": "^3.2.2",
"@defencedigital/eslint-config-react": "^3.2.2",
"@defencedigital/fonts": "^3.2.2",
"@defencedigital/icon-library": "^3.3.0",
"@defencedigital/react-component-library": "^3.2.2",
I have knocked these out of the devDependencies
"@types/react-pdf": "^5.0.9",
"eslint": "^8.8.0",
"eslint-plugin-prettier": "^4.0.0",
React is;
"@types/react": "^17.0.40",
"react": "^17.0.2",
"react-scripts": "^5.0.0",
"styled-components": "^5.3.3",
npm Install gives no errors.
npm start gives errors as follows;
export 'Tab' (imported as 'Tab') was not found in '@defencedigital/react-component-library'
export 'BUTTON_SIZE' (imported as 'BUTTON_SIZE') was not found in '@defencedigital/react-component-library'
TS2305: Module '"@defencedigital/react-component-library"' has no exported member 'Tab'.
2 | import {
3 | TabSet,
ERROR in src/pages/LotMitigation/PerformanceMeasureCard.tsx:5:3
TS2305: Module '"@defencedigital/react-component-library"' has no exported member 'BUTTON_SIZE'.
3 | Button,
4 | BUTTON_VARIANT,
I have other errors but I think that they are to do with upgrading esLint, a few like this;
TS2769: No overload matches this call.
Overload 1 of 2, '(props: (({ children?: ((string | number | boolean | {} | ReactElement<any, string | JSXElementConstructor> | Iterable | ReactPortal | ReactNode[]) & (boolean | ... 2 more ... | ReactPortal)) | null | undefined; ... 18 more ...; footnote?: string | undefined; } | { ...; } | { ...; }) & { ...; }) & { ...; }): ReactElement<...>', gave the following error.
Type '(event: React.ChangeEvent) => void' is not assignable to type '(event: ChangeEvent | MouseEvent<HTMLButtonElement, MouseEvent>, newValue: number | null) => void'.
Types of parameters 'event' and 'event' are incompatible.
Type 'ChangeEvent | MouseEvent<HTMLButtonElement, MouseEvent>' is not assignable to type 'ChangeEvent'.
Type 'MouseEvent<HTMLButtonElement, MouseEvent>' is not assignable to type 'ChangeEvent'.
Types of property 'target' are incompatible.
Type 'EventTarget' is not assignable to type 'EventTarget & HTMLInputElement'.
Type 'EventTarget' is missing the following properties from type 'HTMLInputElement': accept, align, alt, autocomplete, and 328 more.
Overload 2 of 2, '(props: StyledComponentPropsWithAs<FC, any, {}, never, FC, FC>): ReactElement<...>', gave the following error.
Type '(event: React.ChangeEvent) => void' is not assignable to type '(event: ChangeEvent | MouseEvent<HTMLButtonElement, MouseEvent>, newValue: number | null) => void'.
251 | <ScoreNumberInput
252 | name="currentValue"
Beta Was this translation helpful? Give feedback.
All reactions