Skip to content

Commit

Permalink
Upgrade typescript to 3.7.2 (#2237)
Browse files Browse the repository at this point in the history
  • Loading branch information
danrosenthal authored and BPScott committed Nov 18, 2019
1 parent a0622b9 commit 9085064
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 41 deletions.
2 changes: 2 additions & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

### Dependency upgrades

- Upgraded to TypeScript `v3.7.2` ([#2237](https://github.com/Shopify/polaris-react/pull/2237))

### Code quality

- Changed `aria-labelledby` to always exist on `TextField` ([#2401](https://github.com/Shopify/polaris-react/pull/2401))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"shx": "^0.3.2",
"storybook-chromatic": "^3.1.0",
"svgo": "^1.3.0",
"typescript": "~3.5.1"
"typescript": "~3.7.2"
},
"peerDependencies": {
"react": "^16.8.6",
Expand Down
13 changes: 8 additions & 5 deletions src/components/ContextualSaveBar/ContextualSaveBar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from 'react';
import {ContextualSaveBarProps, useFrame} from '../../utilities/frame';
import {
ContextualSaveBarProps as ContextualSaveBarProps1,
useFrame,
} from '../../utilities/frame';

// 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 {}
// that the interface defining the props is defined in this file, not imported
// from elsewhere. This silly workaround ensures that the Props Explorer table
// is generated correctly.
export interface ContextualSaveBarProps extends ContextualSaveBarProps1 {}

export const ContextualSaveBar = React.memo(function ContextualSaveBar({
message,
Expand Down
3 changes: 3 additions & 0 deletions src/components/DropZone/tests/DropZone.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ function setBoundingClientRect(size: keyof typeof widths) {
left: 0,
bottom: 0,
right: 0,
x: 0,
y: 0,
toJSON() {},
};
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/RangeSlider/RangeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {RangeSliderDefault} from './utilities';
import {SingleThumb, DualThumb} from './components';

// 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 `RangeSlider extends React.Component<RangeSliderProps>`
// that the interface defining the props is defined in this file, not imported
// from elsewhere. This silly workaround ensures that the Props Explorer table
// is generated correctly.
interface Props extends RangeSliderProps {}

export function RangeSlider({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,16 +489,7 @@ describe('<DualThumb />', () => {
});
getBoundingClientRectSpy = jest
.spyOn(Element.prototype, 'getBoundingClientRect')
.mockImplementation(() => {
return {
width: 124,
height: 0,
top: 0,
left: -12,
bottom: 0,
right: 0,
};
});
.mockImplementation(mockGetBoundingClientRect);
});

afterAll(() => {
Expand Down Expand Up @@ -702,16 +693,7 @@ describe('<DualThumb />', () => {
});
getBoundingClientRectSpy = jest
.spyOn(Element.prototype, 'getBoundingClientRect')
.mockImplementation(() => {
return {
width: 124,
height: 0,
top: 0,
left: -12,
bottom: 0,
right: 0,
};
});
.mockImplementation(mockGetBoundingClientRect);
});

afterAll(() => {
Expand Down Expand Up @@ -1042,3 +1024,19 @@ function findThumbUpper(containerComponent: ReactWrapper): ReactWrapper {
function findTrack(containerComponent: ReactWrapper): ReactWrapper {
return findByTestID(containerComponent, 'trackWrapper');
}

function mockGetBoundingClientRect(): ReturnType<
Element['getBoundingClientRect']
> {
return {
width: 124,
height: 0,
top: 0,
left: -12,
bottom: 0,
right: 0,
x: 0,
y: 0,
toJSON() {},
};
}
6 changes: 3 additions & 3 deletions src/components/ThemeProvider/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export function ThemeProvider({
[customProperties, themeConfig, unstableGlobalTheming],
);

// We want these values to be `null` instead of `undefined` when not set.
// We want these values to be empty string instead of `undefined` when not set.
// 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'] || '';
const color = customProperties['--p-text-on-surface'] || '';

useEffect(() => {
document.body.style.backgroundColor = backgroundColor;
Expand Down
10 changes: 5 additions & 5 deletions src/components/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
import {useUniqueId} from '../../utilities/unique-id';
import {useDeepEffect} from '../../utilities/use-deep-effect';
import {useAppBridge} from '../../utilities/app-bridge';

// 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 `ComposedProps = ToastProps & WithAppProviderProps`
export interface ToastProps extends ToastProps {}
// that the interface defining the props is defined in this file, not imported
// from elsewhere. This silly workaround ensures that the Props Explorer table
// is generated correctly.
export interface ToastProps extends ToastProps1 {}

export const Toast = React.memo(function Toast(props: ToastProps) {
const id = useUniqueId('Toast');
Expand Down
3 changes: 3 additions & 0 deletions src/utilities/tests/is-element-in-viewport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,8 @@ function mockGetBoundingClientRect({
right,
height,
width,
x: 0,
y: 0,
toJSON() {},
});
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16886,10 +16886,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@~3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.1.tgz#ba72a6a600b2158139c5dd8850f700e231464202"
integrity sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==
typescript@~3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb"
integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==

ua-parser-js@^0.7.18:
version "0.7.19"
Expand Down

0 comments on commit 9085064

Please sign in to comment.