Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compiler-cli): add support to extend
angularCompilerOptions
`TypeScript` only supports merging and extending of `compilerOptions`. This is an implementation to support extending and inheriting of `angularCompilerOptions` from multiple files. Closes: #22684
- Loading branch information
1 parent
cd58c0a
commit 3a9a286
Showing
2 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {readConfiguration} from '../src/perform_compile'; | ||
|
||
import {TestSupport, setup} from './test_support'; | ||
|
||
describe('perform_compile', () => { | ||
let testSupport: TestSupport; | ||
|
||
beforeEach(() => { testSupport = setup(); }); | ||
|
||
function writeSomeRoutes() { | ||
testSupport.writeFiles({ | ||
'src/tsconfig-level-1.json': ` | ||
extends: "src/tsconfig-level-2.json", | ||
angularCompilerOptions: { | ||
"annotateForClosureCompiler": true | ||
} | ||
`, | ||
'src/tsconfig-level-2.json': ` | ||
extends: "src/tsconfig-level-3.json", | ||
angularCompilerOptions: { | ||
"skipMetadataEmit": true | ||
} | ||
`, | ||
'src/tsconfig-level-3.json': ` | ||
angularCompilerOptions: { | ||
"annotateForClosureCompiler": false, | ||
"annotationsAs": "decorators" | ||
} | ||
`, | ||
}); | ||
} | ||
|
||
it('should merge tsconfig "angularCompilerOptions"', () => { | ||
writeSomeRoutes(); | ||
const {options} = readConfiguration('src/tsconfig-level-1.json'); | ||
|
||
expect(options.annotateForClosureCompiler).toBe(true); | ||
expect(options.annotationsAs).toBe('decorators'); | ||
expect(options.skipMetadataEmit).toBe(false); | ||
}); | ||
|
||
}); |