Skip to content

Commit

Permalink
Revert "Upgrade typescript to 3.7.2 (#2237)"
Browse files Browse the repository at this point in the history
This reverts commit 9085064.
  • Loading branch information
dleroux committed Dec 4, 2019
1 parent c78abcb commit f7bf6cf
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 48 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"shx": "^0.3.2",
"storybook-chromatic": "^3.1.0",
"svgo": "^1.3.0",
"typescript": "~3.7.2"
"typescript": "~3.5.1"
},
"peerDependencies": {
"react": "^16.8.6",
Expand Down
13 changes: 5 additions & 8 deletions src/components/ContextualSaveBar/ContextualSaveBar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React from 'react';
import {
ContextualSaveBarProps as ContextualSaveBarProps1,
useFrame,
} from '../../utilities/frame';
import {ContextualSaveBarProps, useFrame} from '../../utilities/frame';

// The script in the styleguide that generates the Props Explorer data expects
// 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 {}
// 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 {}

export const ContextualSaveBar = React.memo(function ContextualSaveBar({
message,
Expand Down
3 changes: 0 additions & 3 deletions src/components/DropZone/tests/DropZone.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,6 @@ 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
// 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.
// 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>`
interface Props extends RangeSliderProps {}

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

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

afterAll(() => {
Expand Down Expand Up @@ -1025,19 +1043,3 @@ 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 empty string instead of `undefined` when not set.
// We want these values to be `null` 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'] || '';
const color = customProperties['--p-text-on-surface'] || '';
const backgroundColor = customProperties['--p-surface-background'] || null;
const color = customProperties['--p-text-on-surface'] || null;

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 as ToastProps1, useFrame} from '../../utilities/frame';
import {ToastProps, 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
// 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 {}
// 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 {}

export const Toast = React.memo(function Toast(props: ToastProps) {
const id = useUniqueId('Toast');
Expand Down
3 changes: 0 additions & 3 deletions src/utilities/tests/is-element-in-viewport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,5 @@ 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.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb"
integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==
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==

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

0 comments on commit f7bf6cf

Please sign in to comment.