You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|--sourceRoot LOCATION|[sourceRoot](#sourceroot)|Specifies the location where debugger should locate TypeScript files instead of source locations.|
63
-
|--target VERSION|[target](#target)|Specify ECMAScript target version: `'es3'` or `'es5'`|
64
-
|--out FILE|[out](#out)|Concatenate and emit output to a single file.|
65
-
|--outDir DIRECTORY|[outDir](#outdir)|Redirect output structure to the directory.|
66
+
|--suppressImplicitAnyIndexErrors|[suppressImplicitAnyIndexErrors](#suppressimplicitanyindexerrors)|Specifies the location where debugger should locate TypeScript files instead of source locations.|
67
+
|--target VERSION|[target](#target)|Specify ECMAScript target version: `'es3'`, `'es5'`, or `'es6'`|
68
+
66
69
67
70
For file ordering, look at [JavaScript Generation](#javascript-generation).
68
71
@@ -87,12 +90,14 @@ For file ordering, look at [JavaScript Generation](#javascript-generation).
87
90
|[options](#grunt-ts-target-options)|target||
88
91
|[out](#out)|target|`string` - instruct `tsc` to concatenate output to this file.|
89
92
|[outDir](#outdir)|target|`string` - instruct `tsc` to emit JS to this directory.|
93
+
|[preserveConstEnums](#preserveconstenums)|option|`true`, `false` (default) - If true, const enums will be kept as enums in the emitted JS.|
90
94
|[reference](#reference)|target|`string` - tells grunt-ts which file to use for maintaining references|
91
95
|[removeComments](#removecomments)|option|`true` (default), `false` - removes comments in emitted JS|
92
96
|[sourceRoot](#sourceroot)|option|`string` - root for referencing TS files in `.js.map`|
93
97
|[sourceMap](#sourcemap)|option|`true` (default), `false` - indicates if source maps should be generated (`.js.map`)|
98
+
|[suppressImplicitAnyIndexErrors](#suppressimplicitanyindexerrors)|option|`false` (default), `true` - indicates if TypeScript should allow access to properties of an object by string indexer when `--noImplicitAny` is active, even if TypeScript doesn't know about them.|
94
99
|[src](#src)|target|`string` or `string[]` - glob of TypeScript files to compile.|
|[target](#target)|option|`'es5'` (default), `'es3'`, or `'es6'` - targeted ECMAScript version|
96
101
|[verbose](#verbose)|option|`true`, `false` (default) - logs `tsc` command-line options to console|
97
102
|[watch](#watch)|target|`string` - will watch for changes in the specified directory or below|
98
103
@@ -528,6 +533,26 @@ grunt.initConfig({
528
533
});
529
534
````
530
535
536
+
#### noEmitOnError
537
+
538
+
````javascript
539
+
true|false (default)
540
+
````
541
+
542
+
Set to true to pass `--noEmitOnError` to the compiler. If set to true, TypeScript will not emit JavaScript if there is a type error. This flag does not affect the Grunt pipeline; to force the Grunt pipeline to continue (or halt) in the presence of TypeScript type errors, see [failOnTypeErrors](#failontypeerrors).
543
+
544
+
````javascript
545
+
grunt.initConfig({
546
+
ts: {
547
+
default: {
548
+
options: {
549
+
noEmitOnError:true
550
+
}
551
+
}
552
+
}
553
+
});
554
+
````
555
+
531
556
#### noImplicitAny
532
557
533
558
````javascript
@@ -548,6 +573,26 @@ grunt.initConfig({
548
573
});
549
574
````
550
575
576
+
#### preserveConstEnums
577
+
578
+
````javascript
579
+
true|false (default)
580
+
````
581
+
582
+
Set to true to pass `--preserveConstEnums` to the compiler. If set to true, TypeScript will emit code that allows other JavaScript code to use the enum. If false (the default), TypeScript will inline the enum values as magic numbers with a comment in the emitted JS.
583
+
584
+
````javascript
585
+
grunt.initConfig({
586
+
ts: {
587
+
default: {
588
+
options: {
589
+
preserveConstEnums:true
590
+
}
591
+
}
592
+
}
593
+
});
594
+
````
595
+
551
596
#### sourceMap
552
597
553
598
````javascript
@@ -584,13 +629,47 @@ grunt.initConfig({
584
629
});
585
630
````
586
631
632
+
633
+
#### suppressImplicitAnyIndexErrors
634
+
635
+
````javascript
636
+
true|false (default)
637
+
````
638
+
639
+
Set to true to pass `--suppressImplicitAnyIndexErrors` to the compiler. If set to true, TypeScript will allow access to properties of an object by string indexer when `--noImplicitAny` is active, even if TypeScript doesn't know about them. This setting has no effect unless `--noImplicitAny` is active.
640
+
641
+
````javascript
642
+
grunt.initConfig({
643
+
ts: {
644
+
default: {
645
+
options: {
646
+
suppressImplicitAnyIndexErrors:true,
647
+
noImplicitAny:true
648
+
}
649
+
}
650
+
}
651
+
});
652
+
````
653
+
654
+
For example, the following code would not compile with `--noImplicitAny` alone, but it would be legal with `--noImplicitAny` and `--suppressImplicitAnyIndexErrors` both enabled:
655
+
656
+
````typescript
657
+
interfaceperson {
658
+
name:string;
659
+
}
660
+
661
+
var p :person= { name: "Test" };
662
+
p["age"] =101; //property age does not exist on interface person.
663
+
console.log(p["age"]);
664
+
````
665
+
587
666
#### target
588
667
589
668
````javascript
590
-
"es5" (default) |"es3"
669
+
"es5" (default) |"es3"|"es6"
591
670
````
592
671
593
-
Allows the developer to specify if they are targeting ECMAScript version 3or 5. Only select ES3 if you are targeting old browsers (IE8 or below). The default for grunt-ts (es5) is different than the default for `tsc` (es3).
672
+
Allows the developer to specify if they are targeting ECMAScript version 3, 5, or 6. Support for `es6` emit was added in TypeScript 1.4 and is listed as experimental. Only select ES3 if you are targeting old browsers (IE8 or below). The default for grunt-ts (es5) is different than the default for `tsc` (es3).
0 commit comments