-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade typescript to 3.7.2 #2237
Conversation
8b02c24
to
5a91b35
Compare
💦 Potential splash zone of changes introduced to
DetailsAll files potentially affected (total: 1)📄
|
😢
|
I think past me could be responsible for this issue (#1650 ). What do you think @BPScott? Specifically this line: https://github.com/Shopify/polaris-react/pull/1650/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R167 |
Yeah that looks likely, typescript-eslint-parser got deprecated and you need to move over to typescript-eslint/parser to support new versions of TS. We've still not got a fix for that into eslint-plugin-shopify yet so we still need that resolution, but we might be able to bump the version that it points at |
Yay a new SK with a new eslint-plugin-shopify has been released that removes the need for that resolutions dance. I'll see about updating in the new week or so |
#2369 is the PR for the SK update, but alas we're blocked on that because thanks annoyances with the prettier-vscode version (we've updated to eslint 6 but they haven't and that causes problems) |
c9cd99e
to
892a15b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the liberty of rebasing this and when i saw 3.6.3 worked flawlessly I felt adventurous and tried to update to 3.7, which required a few small changes
|
||
// The script in the styleguide that generates the Props Explorer data expects | ||
// a component's props to be found in the Props interface. This silly workaround | ||
// ensures that the Props Explorer table is generated correctly, instead of | ||
// crashing if we write `ContextualSaveBar extends React.Component<ContextualSaveBarProps>` | ||
export interface ContextualSaveBarProps extends ContextualSaveBarProps {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS 3.7 stopped you having a local type with the same name as an import https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/#local-and-imported-type-declarations-now-conflict
The renaming dance is stupid but the props explorer doesnt find the types if you don't define the type in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thumbs upped your comment but I do not thumbs up anything that's going on here
@@ -469,6 +469,9 @@ function setBoundingClientRect(size: keyof typeof widths) { | |||
left: 0, | |||
bottom: 0, | |||
right: 0, | |||
x: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates to the type that Element.getBoundingClientRect()
returns added these new values so we need to add them to the mock (this crops up a few times) https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/#dom-changes
// Otherwise, setting a style property to `undefined` does not remove it from the DOM. | ||
const backgroundColor = customProperties['--p-surface-background'] || null; | ||
const color = customProperties['--p-text-on-surface'] || null; | ||
const backgroundColor = customProperties['--p-surface-background'] || ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backgroundColor is now not nullable. color can be nullable but i figured we might as well make this consistent as it seems to behave the same in chrome for me. @tmlayton can you confirm the intended behaviour still works for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the 🎩 looks good I’m fine with it. Try toggling global theming on and off and make sure it works.
While 3.7.x is super shiny, we might need update to babel 7.7.x and poke at our babel config for full support of stuff like optional chaining and nullish coalescing as the storybook build is done using babel rather than tsc, but that's a task for later. |
892a15b
to
5c012da
Compare
5c012da
to
4d4c4d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do something about that whole styleguide props explorer script thing huh
|
||
// The script in the styleguide that generates the Props Explorer data expects | ||
// a component's props to be found in the Props interface. This silly workaround | ||
// ensures that the Props Explorer table is generated correctly, instead of | ||
// crashing if we write `ContextualSaveBar extends React.Component<ContextualSaveBarProps>` | ||
export interface ContextualSaveBarProps extends ContextualSaveBarProps {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thumbs upped your comment but I do not thumbs up anything that's going on here
@@ -2,16 +2,16 @@ import React, {useRef} from 'react'; | |||
import {Toast as AppBridgeToast} from '@shopify/app-bridge/actions'; | |||
|
|||
import {DEFAULT_TOAST_DURATION} from '../Frame'; | |||
import {ToastProps, useFrame} from '../../utilities/frame'; | |||
import {ToastProps as ToastProps1, useFrame} from '../../utilities/frame'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks I hate it
Revert "Upgrade typescript to 3.7.2 (#2237)"
* Revert "Revert "Upgrade typescript to 3.7.2 (#2237)"" This reverts commit f7bf6cf. * Use class methods instead of getters of undefined properties If you have an uninitialized property that then gets referenced (like by having a getter for it) then TS emits declarations that break in consuming projects. Convert a bunch of cases where we created getters for non-existant properties to use boring old method functions. * Update changelog
⏫ TypeScript 3.6.3