Skip to content
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

Downgrade TypeScript to ~3.6.0 #9826

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion addons/storyshots/storyshots-puppeteer/src/axeTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export const axeTest = (customConfig: Partial<CommonConfig> = {}) =>
...customConfig,
async testBody(page, options) {
const parameters = options.context.parameters.a11y;
const include = parameters?.element ?? '#root';
const element = (parameters === null || parameters === undefined) ? undefined : parameters.element;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only place in the codebase that I could find that took advantage of the optional chaining and nullish coalescing operator introduced in 3.7.

I replaced it with the equivalent code here.

const include = (element === null || element === undefined) ? '#root' : element;
await expect(page).toPassAxeTests({ ...parameters, include });
},
});
2 changes: 2 additions & 0 deletions app/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@angular/compiler-cli": "^8.2.8",
Copy link
Contributor Author

@lychyi lychyi Feb 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two dependencies @angular/compiler-cli and @angular-devkit/build-angular are required for this package but hoisted from a different location (examples/angular-cli here and here).

These two additions to dependencies guarantees that they're here in this package. If these are missing, the build and tests will fail since yarn install nests them in example/angular-cli after changing TypeScript to ~3.6.0 for some reason.

🤷‍♂

"@angular-devkit/build-angular": "~0.803.6",
"@storybook/addons": "6.0.0-alpha.10",
"@storybook/core": "6.0.0-alpha.10",
"@storybook/node-logger": "6.0.0-alpha.10",
Expand Down
2 changes: 1 addition & 1 deletion app/angular/src/server/angular-cli_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function applyAngularCliWebpackConfig(baseConfig: any, cliWebpackConfigOp
// todo add type for acc
const entry = [
...baseConfig.entry,
...Object.values(cliStyleConfig.entry).reduce((acc: any, item) => acc.concat(item), []),
...Object.values<any>(cliStyleConfig.entry).reduce((acc: any, item) => acc.concat(item), []),
Copy link
Contributor Author

@lychyi lychyi Feb 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After installing TypeScript ~3.6.0, this line errors out: TS2461: Type 'unknown' is not an array type.

This is because unknown is the type for cliStyleConfig.entry if you don't specify so I just went ahead and updated the generic to match the type (which is any according to my editor).

];

const module = {
Expand Down
1 change: 1 addition & 0 deletions lib/ui/src/components/sidebar/treeview/treeview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const linked = (
}: { onClick: Function; onKeyUp: Function; Link: ComponentType; prefix: string }
) => {
const Linked = React.memo(p => (
// @ts-ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, compiling TS doesn't quite ignore the onKeyUp, it references line 52 instead so I had to add a // @ts-ignore here. I'm not sure if this is different in TS3.7 vs TS3.6.

<L
prefix={prefix}
{...p}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
"trash": "^6.1.1",
"ts-dedent": "^1.1.1",
"ts-jest": "^24.0.2",
"typescript": "^3.4.0",
"typescript": "~3.6.0",
"wait-on": "^4.0.0"
},
"optionalDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29353,6 +29353,11 @@ typescript@^2.4.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==

typescript@~3.6.0:
version "3.6.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.5.tgz#dae20114a7b4ff4bd642db9c8c699f2953e8bbdb"
integrity sha512-BEjlc0Z06ORZKbtcxGrIvvwYs5hAnuo6TKdNFL55frVDlB+na3z5bsLhFaIxmT+dPWgBIjMo6aNnTOgHHmHgiQ==

ua-parser-js@^0.7.18:
version "0.7.21"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777"
Expand Down