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

[typescript] tsc cannot resolve sub-modules #7928

Closed
shousper opened this issue Aug 27, 2017 · 1 comment
Closed

[typescript] tsc cannot resolve sub-modules #7928

shousper opened this issue Aug 27, 2017 · 1 comment

Comments

@shousper
Copy link

Problem description

Trying to import from material-ui/styles (any submodule actually) yields compilation errors from tsc when noImplicitAny is enabled.

(3,32): error TS7016: Could not find a declaration file for module 'material-ui/styles'. '/Users/shousper/Source/test/node_modules/material-ui/styles/index.js' implicitly has an 'any' type.
  Try `npm install @types/material-ui/styles` if it exists or add a new declaration (.d.ts) file containing `declare module 'material-ui/styles';`

Steps to reproduce

yarn add material-ui@next typescript
echo 'import { createMuiTheme } from \'material-ui/styles\'' > index.ts
echo 'const x = createMuiTheme()' >> index.ts
yarn run tsc -- --noImplicitAny index.ts

Versions

  • Material-UI: 1.0.0-beta.6
  • React: N/A
  • Browser: N/A
@sebald
Copy link
Member

sebald commented Aug 28, 2017

Duplicate of #7853

tl;dr; add material-ui to your types in tsconfig. Will not be necessary anymore with the next beta release, though.

@sebald sebald closed this as completed Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants