Here I see an example project using material-ui.
I see I have the following packages inside of package.json file
{
...
"dependencies": {
"@material-ui/core": "^1.4.1",
...
},
"devDependencies": {
"@types/material-ui": "^0.20.6",
...
},
...
}
After the npm install
, I see the following directories in my project folder
node_modules/@types/material-ui/
node_modules/@material-ui/core/
Here are my questions:
I wanted to understand why material-ui uses @
as part of its package name, is it true that this kind of package naming means it's a TS package? i.e., it itself carries the type information.
If the above is true, is it true that /@types/material-ui/
is not needed at all?
@
in the package name doesn't mean it is a TypeScript package; plain JavaScript packages can also have the @
prefix.
The @
prefix means this is a scoped package; i.e. there is a family of packages under @material-ui/
as well as under @types/
.
In this specific case, @material-ui/core
contains its own type definitions (*.d.ts
files), so @types/material-ui
is not needed and will not actually be used. In general @types/
packages are needed for plain JavaScript packages which do not contain any type definitions on their own.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With