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 material-ui@next types configuration #11170

Closed
duvet86 opened this issue Apr 28, 2018 · 3 comments
Closed

Typescript material-ui@next types configuration #11170

duvet86 opened this issue Apr 28, 2018 · 3 comments
Labels
support: Stack Overflow Please ask the community on Stack Overflow typescript

Comments

@duvet86
Copy link
Contributor

duvet86 commented Apr 28, 2018

After reading Typescript Types in beta 6 and Declaring typings for modules in subfolders I still can't figure out how to add material-ui@next types to my project.
Adding "material-ui" to "types' in my tsconfig doesn't work and the only workable solution I've found is adding node_modules/**/*.d.ts to my "include" but when I do that I can't anymore import files using an absolute path.
Basically I can't do
import Component from "lib/Component";
but I have to use a relative path "./src/lib/Component"

Cheers

Tech Version
"material-ui": "^1.0.0-beta.43",
TypeScript 2.8
@oliviertassinari oliviertassinari added typescript support: Stack Overflow Please ask the community on Stack Overflow labels Apr 28, 2018
@support
Copy link

support bot commented Apr 28, 2018

👋 Thanks for using Material-UI!

We use the issue tracker exclusively for bug reports and feature requests, however,
this issue appears to be a support request or question. Please ask on StackOverflow where the
community will do their best to help. There is a "material-ui" tag that you can use to tag your
question.

If you would like to link from here to your question on SO, it will help others find it.
If your issues is confirmed as a bug, you are welcome to reopen the issue using the issue template.

@support support bot closed this as completed Apr 28, 2018
@oliviertassinari
Copy link
Member

@duvet86
Copy link
Contributor Author

duvet86 commented Apr 28, 2018

Thank you very much.
I've compared the tsconfig from the example and the one in my project.
No need for types or includes the fix is "moduleResolution": "node".
For reference my tsconfig:

{
  "compilerOptions": {
    /* Basic Options */
    "target": "es6",
    "module": "esnext",
    "allowJs": true,
    "jsx": "react",
    "sourceMap": true,
    "outDir": "./public/",

    /* Strict Type-Checking Options */
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,

    /* Additional Checks */
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,

    /* Module Resolution Options */
    "moduleResolution": "node",
    "baseUrl": "./src" 
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: Stack Overflow Please ask the community on Stack Overflow typescript
Projects
None yet
Development

No branches or pull requests

2 participants