File tree Expand file tree Collapse file tree
docs/documentation/stories Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,18 @@ npm install d3 --save
99npm install @types/d3 --save-dev
1010```
1111
12+ Then open ` src/tsconfig.app.json ` and add it to the ` types ` array:
13+
14+ ```
15+ "types":[
16+ "d3"
17+ ]
18+ ```
19+
20+ If the library you added typings for is only to be used on your e2e tests,
21+ instead use ` e2e/tsconfig.e2e.json ` .
22+ The same goes for unit tests and ` src/tsconfig.spec.json ` .
23+
1224If the library doesn't have typings available at ` @types/ ` , you can still use it by
1325manually adding typings for it:
1426
Original file line number Diff line number Diff line change 1+ {<% if (ng4) { %>
2+ "extends" : " <%= relativeRootPath %>/tsconfig.json" ,
3+ "compilerOptions" : {
4+ "lib" : [
5+ " es2016" ,
6+ " dom"
7+ ],<% } else { %>
8+ "compilerOptions" : {
9+ "sourceMap" : true ,
10+ "declaration" : false ,
11+ "moduleResolution" : " node" ,
12+ "emitDecoratorMetadata" : true ,
13+ "experimentalDecorators" : true ,
14+ "lib" : [
15+ " es2016" ,
16+ " dom"
17+ ],<% } %>
18+ "outDir" : " <%= relativeRootPath %>/out-tsc/app" ,
19+ "target" : " es5" ,
20+ "module" : " es2015" ,
21+ "baseUrl" : " " ,
22+ "types" : []
23+ },
24+ "exclude" : [
25+ " test.ts" ,
26+ " **/*.spec.ts"
27+ ]
28+ }
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ {<% if (ng4) { %>
2+ "extends" : " <%= relativeRootPath %>/tsconfig.json" ,
3+ "compilerOptions" : {<% } else { %>
4+ "compilerOptions" : {
5+ "sourceMap" : true ,
6+ "declaration" : false ,
7+ "moduleResolution" : " node" ,
8+ "emitDecoratorMetadata" : true ,
9+ "experimentalDecorators" : true ,
10+ "lib" : [
11+ " es2016"
12+ ],<% } %>
13+ "outDir" : " <%= relativeRootPath %>/out-tsc/spec" ,
14+ "module" : " commonjs" ,
15+ "target" : " es6" ,
16+ "baseUrl" : " " ,
17+ "types" : [
18+ " jasmine" ,
19+ " node"
20+ ]
21+ },
22+ "files" : [
23+ " test.ts"
24+ ],
25+ "include" : [
26+ " **/*.spec.ts"
27+ ]
28+ }
Original file line number Diff line number Diff line change 1515 "main" : " main.ts" ,
1616 "polyfills" : " polyfills.ts" ,
1717 "test" : " test.ts" ,
18- "tsconfig" : " tsconfig.json" ,
18+ "tsconfig" : " tsconfig.app.json" ,
19+ "testTsconfig" : " tsconfig.spec.json" ,
1920 "prefix" : " <%= prefix %>" ,
2021 "styles" : [
2122 " styles.<%= styleExt %>"
3536 },
3637 "lint" : [
3738 {
38- "files" : " <%= sourceDir %>/**/*.ts" ,
39- "project" : " <%= sourceDir %>/tsconfig.json"
39+ "project" : " <%= sourceDir %>/tsconfig.app.json"
4040 },
4141 {
42- "files" : " e2e/**/*.ts" ,
43- "project" : " e2e/tsconfig.json"
42+ "project" : " <%= sourceDir %>/tsconfig.spec.json"
43+ },
44+ {
45+ "project" : " e2e/tsconfig.e2e.json"
4446 }
4547 ],
4648 "test" : {
Original file line number Diff line number Diff line change 1- {
2- "compileOnSave" : false ,
1+ {<% if (ng4) { %>
2+ "extends" : " ../tsconfig.json" ,
3+ "compilerOptions" : {<% } else { %>
34 "compilerOptions" : {
5+ "sourceMap" : true ,
46 "declaration" : false ,
7+ "moduleResolution" : " node" ,
58 "emitDecoratorMetadata" : true ,
69 "experimentalDecorators" : true ,
710 "lib" : [
811 " es2016"
9- ],
10- "module" : " commonjs" ,
11- "moduleResolution" : " node" ,
12+ ],<% } %>
1213 "outDir" : " ../dist/out-tsc-e2e" ,
13- "sourceMap " : true ,
14+ "module " : " commonjs " ,
1415 "target" : " es6" ,
15- "typeRoots" : [
16- " ../node_modules/@types"
16+ "types" :[
17+ " jasmine" ,
18+ " node"
1719 ]
1820 }
1921}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ exports.config = {
2222 } ,
2323 beforeLaunch : function ( ) {
2424 require ( 'ts-node' ) . register ( {
25- project : 'e2e'
25+ project : 'e2e/tsconfig.e2e.json '
2626 } ) ;
2727 } ,
2828 onPrepare ( ) {
Original file line number Diff line number Diff line change 1+ {
2+ "compileOnSave" : false ,
3+ "compilerOptions" : {
4+ "outDir" : " ./dist/out-tsc" ,
5+ "sourceMap" : true ,
6+ "declaration" : false ,
7+ "moduleResolution" : " node" ,
8+ "emitDecoratorMetadata" : true ,
9+ "experimentalDecorators" : true ,
10+ "lib" : [
11+ " es2016"
12+ ]
13+ }
14+ }
Original file line number Diff line number Diff line change 9494 },
9595 "tsconfig" : {
9696 "type" : " string" ,
97- "default" : " tsconfig.json" ,
97+ "default" : " tsconfig.app. json" ,
9898 "description" : " The name of the TypeScript configuration file."
9999 },
100+ "testTsconfig" : {
101+ "type" : " string" ,
102+ "description" : " The name of the TypeScript configuration file for unit tests."
103+ },
100104 "prefix" : {
101105 "type" : " string" ,
102106 "description" : " The prefix to apply to generated selectors."
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ export class NgCliWebpackConfig {
106106
107107 public addAppConfigDefaults ( appConfig : any ) {
108108 const appConfigDefaults : any = {
109+ testTsconfig : appConfig . tsconfig ,
109110 scripts : [ ] ,
110111 styles : [ ]
111112 } ;
You can’t perform that action at this time.
0 commit comments