velop velop - 1 year ago 110
TypeScript Question

Why do I need typings to work with typescript?

I've read: How to setup Material-UI for React with Typescript?

I'm completely new to typescript and thought that typescript is a superset of normal javascript. If so why do I have to do:

typings install dt~material-ui --global --save
in order to work with material-ui? Why does my materila-ui modules do not load without?

ERROR in ./source/scripts/components/app.tsx
(4,20): error TS2307: Cannot find module 'material-ui/AppBar'.

Answer Source

Are you writing your project in TypeScript? If so and you're using the material-ui then you need to install (or write your own) type declarations (or typings) for every Javascript library you're using in order for the typescript compiler to perform type checking. I suggest you read the typescript docs.

Every module must have type declarations. If you really don't want to install them then one you can write your own and use the any keyword to skip type checking.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download