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

[core] Fix jss v10 types being used #14117

Merged
merged 1 commit into from Jan 8, 2019

Conversation

3 participants
@eps1lon
Copy link
Member

eps1lon commented Jan 8, 2019

Problem: <workspace_root>/package.json forces every jss version to v10 which has breaking changes compared to v9. However @material-ui/core still uses v9 at compile-time (and run-time if the stable styling solution is used).
Solution: use path mapping in tsconfig to resolve the version used in core to v9 while any other package remains on v10.

Closes #14040

"compilerOptions": {
"baseUrl": "../../",
"paths": {
"@material-ui/core": ["packages/material-ui/src"],

This comment has been minimized.

@eps1lon

eps1lon Jan 8, 2019

Member

tsconfigs are only shallow merged so we have to repeat the paths from the extended tsconfig

@eps1lon eps1lon added the typescript label Jan 8, 2019

@oliviertassinari
Copy link
Member

oliviertassinari left a comment

Wow, I would have never imagined a solution was possible in the TypeScript land. I have tried to better use the resolution feature of yarn to scope jss v9 and v10 in the documentation without luck.

@eps1lon

This comment has been minimized.

Copy link
Member

eps1lon commented Jan 8, 2019

This is basically what https://github.com/DefinitelyTyped/DefinitelyTyped#i-want-to-update-a-package-to-a-new-major-version describes. Just not as pretty since v10 is not published under @types.

@eps1lon eps1lon merged commit 3ab4639 into mui-org:master Jan 8, 2019

10 checks passed

argos Everything good!
Details
ci/circleci: checkout Your tests passed on CircleCI!
Details
ci/circleci: test_browser Your tests passed on CircleCI!
Details
ci/circleci: test_build Your tests passed on CircleCI!
Details
ci/circleci: test_material-ui-x Your tests passed on CircleCI!
Details
ci/circleci: test_regressions Your tests passed on CircleCI!
Details
ci/circleci: test_unit Your tests passed on CircleCI!
Details
codecov/patch Coverage not affected when comparing f4281a7...cde6037
Details
codecov/project 100% remains the same compared to f4281a7
Details
deploy/netlify Deploy preview ready!
Details

@eps1lon eps1lon deleted the eps1lon:fix/core/jss-types branch Jan 8, 2019

@oliviertassinari oliviertassinari changed the title core: fix jss v10 types being used [core] Fix jss v10 types being used Jan 8, 2019

@Nibblesh

This comment has been minimized.

Copy link

Nibblesh commented Jan 10, 2019

Having compile issues, seems as though types originally matched the v10 alpha, and the changes to type were to match a different version, but the package json has not been updated to not use v10 so there is a mismatch with the types and the linked package.

From running typescript compiler:


Failed to compile.
--
  |  
  | /app/node_modules/@material-ui/core/styles/createGenerateClassName.d.ts
  | (1,10): Module '"/app/node_modules/jss/src/index"' has no exported member 'GenerateClassName'.

reverting to 3.8.2 allows us to compile

@eps1lon

This comment has been minimized.

Copy link
Member

eps1lon commented Jan 11, 2019

@Nibblesh

  • @material-ui/core requires jss@9
  • @material-ui/styles requires jss@10

This should be reflected in @material-ui/core@3.8.3.

Could list your package.json? If you have @material-ui/styles you cannot use @material-ui/core/styles anymore. Any correct usage should no pass typescript if your're on 3.8.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment