Skip to content

allow baseUrl, paths, rootDirs in tsconfig files #849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dist/main/tsconfig/simpleValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
exports.types = {
string: 'string',
boolean: 'boolean',
number: 'number'
number: 'number',
object: 'object'
};
var SimpleValidator = (function () {
function SimpleValidator(validationInfo) {
Expand Down
6 changes: 6 additions & 0 deletions dist/main/tsconfig/tsconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ var compilerOptionsValidation = {
mapRoot: { type: types.string },
module: { type: types.string, validValues: ['commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'] },
moduleResolution: { type: types.string, validValues: ['classic', 'node'] },
baseUrl: { type: types.string },
paths: { type: types.object },
rootDirs: { type: types.object },
newLine: { type: types.string },
noEmit: { type: types.boolean },
noEmitHelpers: { type: types.boolean },
Expand Down Expand Up @@ -83,6 +86,9 @@ exports.defaults = {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.CommonJS,
moduleResolution: ts.ModuleResolutionKind.NodeJs,
baseUrl: undefined,
paths: undefined,
rootDirs: undefined,
isolatedModules: false,
jsx: ts.JsxEmit.React,
experimentalDecorators: true,
Expand Down
7 changes: 4 additions & 3 deletions lib/main/tsconfig/simpleValidator.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/// Not useful for user input validation
// But great for simple config validation
// But great for simple config validation
// works only by "n" valid options

export var types = {
string: 'string',
boolean: 'boolean',
number: 'number'
number: 'number',
object: 'object'
}

export interface ValidationInfo {
Expand Down Expand Up @@ -41,7 +42,7 @@ export class SimpleValidator {
else {
errors.extraKeys.push(`Unknown Option: ${k}`)
}
}
}
// Do validation
else {
var validationInfo = this.validationInfo[k];
Expand Down
9 changes: 9 additions & 0 deletions lib/main/tsconfig/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ interface CompilerOptions {
mapRoot?: string; // Optionally Specifies the location where debugger should locate map files after deployment
module?: string;
moduleResolution?: string;
baseUrl?: string;
paths?: { [pattern: string]: string[] };
rootDirs?: string[];
newLine?: string;
noEmit?: boolean;
noEmitHelpers?: boolean;
Expand Down Expand Up @@ -88,6 +91,9 @@ var compilerOptionsValidation: simpleValidator.ValidationInfo = {
mapRoot: { type: types.string },
module: { type: types.string, validValues: ['commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'] },
moduleResolution: { type: types.string, validValues: ['classic', 'node'] },
baseUrl: { type: types.string },
paths: { type: types.object },
rootDirs: { type: types.object },
newLine: { type: types.string },
noEmit: { type: types.boolean },
noEmitHelpers: { type: types.boolean },
Expand Down Expand Up @@ -234,6 +240,9 @@ export var defaults: ts.CompilerOptions = {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.CommonJS,
moduleResolution: ts.ModuleResolutionKind.NodeJs,
baseUrl: undefined,
paths: undefined,
rootDirs: undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to provide defaults if they are not activated (basically let the TS compiler do its own default thing). Also explicit undefined initialization not needed (it undefined on read anyways) 🌹

isolatedModules: false,
jsx: ts.JsxEmit.React,
experimentalDecorators: true,
Expand Down