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

[test] Type-check framerfx package #21868

Merged
merged 18 commits into from
Jul 28, 2020
Merged

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Jul 21, 2020

Based on #21888. Diff to #21888 only: eps1lon/material-ui@feat/update-framer...eps1lon:test/framer-typecheck

Enables type-checking for framer/Material-UI.framerfx package and fixes all type errors.

Dropping naming-style since we have a more battle-tested and typed alternative in lodash. naming-style only has ~100 downloads/month which makes it a liability.

TODO:

  • @mbrookes Do you know which TS version framer is using? Edit: unknown, try to not use too modern features (such as as const).

Closes #21887

@mui-pr-bot
Copy link

mui-pr-bot commented Jul 21, 2020

Details of bundle changes

Generated by 🚫 dangerJS against c5bfbde

Copy link
Member

@mbrookes mbrookes left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this. Aside from the couple of questions raised, my main concern is that the changes have been made to generated code, rather than the templates used to generate them.

framer/Material-UI.framerfx/code/AppBar.tsx Show resolved Hide resolved
framer/Material-UI.framerfx/code/Avatar.tsx Outdated Show resolved Hide resolved
framer/Material-UI.framerfx/code/Avatar.tsx Outdated Show resolved Hide resolved
@eps1lon

This comment has been minimized.

@eps1lon eps1lon marked this pull request as draft July 23, 2020 05:21
@eps1lon eps1lon force-pushed the test/framer-typecheck branch from ae01db5 to bc13420 Compare July 23, 2020 09:18
@eps1lon eps1lon marked this pull request as ready for review July 23, 2020 09:37
@eps1lon eps1lon requested a review from mbrookes July 23, 2020 09:37
@mbrookes

This comment has been minimized.

Copy link
Member

@mbrookes mbrookes left a comment

Choose a reason for hiding this comment

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

More questions than comments.

framer/Material-UI.framerfx/design/document.json could be checked in (after opening the package in Framer) so that it doesn't show errors when first opened.

framer/Material-UI.framerfx/code/Checkbox.tsx Show resolved Hide resolved
const iconName = `${iconProp && pascalCase(iconProp)}${
theme === 'Filled' ? '' : theme
}` as keyof typeof Icons;
const Icon = Object.keys(Icons).indexOf(iconName) !== -1 ? Icons[iconName] : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Member Author

Choose a reason for hiding this comment

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

includes was introduced in ES7 (es2016). The published tsconfig indicates ES6 (es2015). Since it's unclear what the actual TS environment in framer is I'd rather downgrade it. Especially because indexOf vs includes has little cost to convert.

@eps1lon eps1lon force-pushed the test/framer-typecheck branch from f5f8394 to d942bd9 Compare July 27, 2020 17:15
@eps1lon eps1lon force-pushed the test/framer-typecheck branch from d942bd9 to 8d468db Compare July 27, 2020 18:23
@eps1lon
Copy link
Member Author

eps1lon commented Jul 27, 2020

Remaining issues in framer are due to an old TypeScript version. They seem to be using a version prior to 3.0 (hence all the errors regarding required props missing since TS < 3.0 did not understand defaultProps).

Since TypeScript 2.9 is no longer supported in DefinitelyTyped I put responsibility for updating TS on framer.

@eps1lon eps1lon requested a review from mbrookes July 27, 2020 18:59
@mbrookes
Copy link
Member

They seem to be using a version prior to 3.0 (hence all the errors regarding required props missing since TS < 3.0 did not understand defaultProps).

Shouldn't we support the version they're using?

@eps1lon
Copy link
Member Author

eps1lon commented Jul 27, 2020

Shouldn't we support the version they're using?

If they use a version that doesn't support React features then we really can't. Because of that version we already have issues. With this PR we're at least sound in TypeScript 3.x. Prior to this PR we're not sound in any TypeScript version.

@eps1lon eps1lon merged commit 3dfb429 into mui:next Jul 28, 2020
@eps1lon eps1lon deleted the test/framer-typecheck branch July 28, 2020 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants