Skip to content

Commit

Permalink
[Core] Fix react types regression (palantir#3390)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Mar 4, 2019
1 parent 2263df4 commit e36b253
Show file tree
Hide file tree
Showing 8 changed files with 357 additions and 374 deletions.
2 changes: 1 addition & 1 deletion config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.7.2",
"version": "2.8.4",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
Expand Down
30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
"verify": "npm-run-all -s compile dist:libs dist:apps -p test lint"
},
"dependencies": {
"@types/chai": "^4.1.7",
"@types/classnames": "^2.2.7",
"@types/enzyme": "^3.1.18",
"@types/enzyme-adapter-react-16": "^1.0.4",
"@types/mocha": "^5.2.6",
"@types/prop-types": "^15.5.9",
"@types/react": "^16.8.3",
"@types/react-dom": "^16.8.2",
"@types/react-transition-group": "^2.0.16",
"@types/sinon": "^7.0.6",
"@types/webpack": "^4.4.24",
"@types/chai": "4.1.7",
"@types/classnames": "2.2.7",
"@types/enzyme": "3.1.15",
"@types/enzyme-adapter-react-16": "1.0.3",
"@types/mocha": "5.2.6",
"@types/prop-types": "15.7.0",
"@types/react": "16.4.18",
"@types/react-dom": "16.0.11",
"@types/react-transition-group": "2.0.14",
"@types/sinon": "7.0.6",
"@types/webpack": "4.4.24",
"chai": "^4.2.0",
"circle-github-bot": "^2.0.1",
"cross-env": "^5.2.0",
Expand All @@ -57,12 +57,14 @@
"stylelint-scss": "^3.3.1",
"typescript": "~2.8.3"
},
"resolutions": {
"@types/enzyme": "3.1.15",
"@types/react": "16.4.18",
"node-gyp": "3.8.0"
},
"engines": {
"node": ">=6.1"
},
"resolutions": {
"node-gyp": "^3.6.3"
},
"repository": {
"type": "git",
"url": "[email protected]:palantir/blueprint.git"
Expand Down
6 changes: 4 additions & 2 deletions packages/core/test/controls/numericInputTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ import {
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26979#issuecomment-465304376
*/
// tslint:disable no-unnecessary-callback-wrapper
const mount = (el: React.ReactElement, options?: MountRendererProps) => untypedMount<NumericInput>(el, options);
const shallow = (el: React.ReactElement, options?: ShallowRendererProps) => untypedShallow<NumericInput>(el, options);
const mount = (el: React.ReactElement<INumericInputProps>, options?: MountRendererProps) =>
untypedMount<NumericInput>(el, options);
const shallow = (el: React.ReactElement<INumericInputProps>, options?: ShallowRendererProps) =>
untypedShallow<NumericInput>(el, options);
// tslint:enable no-unnecessary-callback-wrapper

describe("<NumericInput>", () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/test/tag-input/tagInputTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import { Button, Classes, Intent, ITagInputProps, Keys, Tag, TagInput } from "..
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26979#issuecomment-465304376
*/
// tslint:disable no-unnecessary-callback-wrapper
const mount = (el: React.ReactElement, options?: MountRendererProps) => untypedMount<TagInput>(el, options);
const shallow = (el: React.ReactElement, options?: ShallowRendererProps) => untypedShallow<TagInput>(el, options);
const mount = (el: React.ReactElement<ITagInputProps>, options?: MountRendererProps) =>
untypedMount<TagInput>(el, options);
const shallow = (el: React.ReactElement<ITagInputProps>, options?: ShallowRendererProps) =>
untypedShallow<TagInput>(el, options);
// tslint:enable no-unnecessary-callback-wrapper

const VALUES = ["one", "two", "three"];
Expand Down
3 changes: 1 addition & 2 deletions packages/table/src/interactions/resizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ export class Resizable extends React.PureComponent<IResizableProps, IResizeableS
}

public render() {
// this component is private to this package, so we can do this cast because we know all the uses are internal
const child = React.Children.only(this.props.children) as React.ReactElement;
const child = React.Children.only(this.props.children);
const style = { ...child.props.style, ...this.getStyle() };

if (this.props.isResizable === false) {
Expand Down
5 changes: 2 additions & 3 deletions packages/table/test/tableTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ import { createStringOfLength, createTableOfSize } from "./mocks/table";
/**
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26979#issuecomment-465304376
*/
// tslint:disable no-unnecessary-callback-wrapper
const mount = (el: React.ReactElement, options?: MountRendererProps) => untypedMount<Table>(el, options);
// tslint:enable no-unnecessary-callback-wrapper
// tslint:disable-next-line no-unnecessary-callback-wrapper
const mount = (el: React.ReactElement<ITableProps>, options?: MountRendererProps) => untypedMount<Table>(el, options);

describe("<Table>", function(this) {
// allow retrying failed tests here to reduce flakes.
Expand Down
9 changes: 5 additions & 4 deletions packages/timezone/test/timezonePickerTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ type TimezonePickerShallowWrapper = ShallowWrapper<ITimezonePickerProps, ITimezo
/**
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26979#issuecomment-465304376
*/
// tslint:disable no-unnecessary-callback-wrapper
const shallow = (el: React.ReactElement, options?: ShallowRendererProps): TimezonePickerShallowWrapper =>
untypedShallow<TimezonePicker>(el, options);
// tslint:enable no-unnecessary-callback-wrapper
// tslint:disable-next-line no-unnecessary-callback-wrapper
const shallow = (
el: React.ReactElement<ITimezonePickerProps>,
options?: ShallowRendererProps,
): TimezonePickerShallowWrapper => untypedShallow<TimezonePicker>(el, options);

const VALUE = "America/Los_Angeles";

Expand Down
Loading

0 comments on commit e36b253

Please sign in to comment.