happyZZR1400
happyZZR1400

Reputation: 2405

why you still need usual angular dependencies when you use typedefinitions?

I'm trying to move move angular1.5 project to use typescript. My project compiled with webpack. I noticed that although i included angular typedefinitions inside package.json

"@types/angular": "~1.5.19",
"@types/angular-mocks": "~1.5.5",
"@types/angular-route": "~1.3.2",
"@types/jasmine": "~2.5.37",
"@types/jwt-decode": "~1.4.28",
"@types/lodash": "~4.14.38",
"@types/source-map": "~0.1.29",
"@types/uglify-js": "~2.6.28",
"angular": "~1.5.8",
"angular-mocks": "^1.6.1",
"angular-route": "~1.5.8",

I still need "angular": "~1.5.8" to be included.

If removed it gives me "Error cannot resolve module 'angular'"

here link to my repo

Why javascript angular is still needed if typescript included?

Thanks to all wise guys who understand those things

Upvotes: 0

Views: 29

Answers (1)

Kacper Polak
Kacper Polak

Reputation: 1411

Types are definition of modules for TypeScript. If they are missing TypeScript compiler will show you an error.

You can read more about it here and here.

Some packages have typings itself and don't need to use @types or typings, they usually have typings section in package.json file.

Sumary: If you use TypeScript and package don't have typings itself, you need to use @types or typings.

Upvotes: 1

Related Questions