File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
fixtures/tsconfig/cases/extends-compiler-options Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 11{
22 "compilerOptions" : {
33 "baseUrl" : " ./src" ,
4+ "allowJs" : true ,
45 "emitDecoratorMetadata" : true ,
56 "useDefineForClassFields" : true ,
67 "rewriteRelativeImportExtensions" : true
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ fn test_extend_tsconfig_compiler_options() {
2424
2525 // Should inherit compilerOptions from parent
2626 assert_eq ! ( compiler_options. base_url, Some ( f. join( "src" ) ) ) ;
27+ assert_eq ! ( compiler_options. allow_js, Some ( true ) ) ;
2728 assert_eq ! ( compiler_options. emit_decorator_metadata, Some ( true ) ) ;
2829 assert_eq ! ( compiler_options. use_define_for_class_fields, Some ( true ) ) ;
2930 assert_eq ! ( compiler_options. rewrite_relative_import_extensions, Some ( true ) ) ;
Original file line number Diff line number Diff line change @@ -257,6 +257,12 @@ impl TsConfig {
257257 compiler_options. set_module ( module. to_string ( ) ) ;
258258 }
259259 }
260+
261+ if compiler_options. allow_js ( ) . is_none ( ) {
262+ if let Some ( allow_js) = tsconfig. compiler_options ( ) . allow_js ( ) {
263+ compiler_options. set_allow_js ( * allow_js) ;
264+ }
265+ }
260266 }
261267 /// "Build" the root tsconfig, resolve:
262268 ///
@@ -449,6 +455,9 @@ pub struct CompilerOptions {
449455
450456 /// <https://www.typescriptlang.org/tsconfig/#module>
451457 pub module : Option < String > ,
458+
459+ /// <https://www.typescriptlang.org/tsconfig/#allowJs>
460+ pub allow_js : Option < bool > ,
452461}
453462
454463impl CompilerOptions {
@@ -620,6 +629,16 @@ impl CompilerOptions {
620629 fn set_module ( & mut self , module : String ) {
621630 self . module = Some ( module) ;
622631 }
632+
633+ /// Whether to allow js.
634+ fn allow_js ( & self ) -> Option < & bool > {
635+ self . allow_js . as_ref ( )
636+ }
637+
638+ /// Sets whether to allow js.
639+ fn set_allow_js ( & mut self , allow_js : bool ) {
640+ self . allow_js = Some ( allow_js) ;
641+ }
623642}
624643
625644/// Value for the "extends" field.
You can’t perform that action at this time.
0 commit comments