Skip to content

Commit 445e5a6

Browse files
devversionandrewseguin
authored andcommitted
build: enable esmoduleinterop option in scripts and .ng-dev
Similar to the `/tsconfig.json` and the `tools/tsconfig.json`, we should enable the `esModuleInterop` from TypeScript in the `scripts/` directory. This is necessary to ensure that scripts part of both compilations. e.g. when a file in `scripts/` imports from `tools/` are compatible without needing two coordinated compilations (using e.g TS project references..). In general enabling the interop means more consistency in the repo. Then only remaining exception are the schematics which we can clean-up in the future when we ship them as ES modules.
1 parent 9be3c46 commit 445e5a6

26 files changed

+41
-32
lines changed

.ng-dev/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"strict": true,
44
"target": "es2015",
55
"module": "commonjs",
6+
"esModuleInterop": true,
67
"noEmit": true,
78
"skipLibCheck": true,
89
"types": []

scripts/breaking-changes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {join, relative} from 'path';
22
import {readFileSync} from 'fs';
3-
import * as chalk from 'chalk';
4-
import * as ts from 'typescript';
3+
import chalk from 'chalk';
4+
import ts from 'typescript';
55
import * as tsutils from 'tsutils';
66

77
const projectRoot = process.cwd();

scripts/check-mdc-exports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {join} from 'path';
22
import {readdirSync, existsSync} from 'fs';
3-
import * as ts from 'typescript';
4-
import * as chalk from 'chalk';
3+
import ts from 'typescript';
4+
import chalk from 'chalk';
55
import {config} from './check-mdc-exports-config';
66

77
// Script which ensures that a particular MDC package exports all of the same symbols as its

scripts/check-mdc-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {readdirSync, readFileSync} from 'fs';
22
import {join, basename} from 'path';
33
import {sync as glob} from 'glob';
4-
import * as chalk from 'chalk';
5-
import * as ts from 'typescript';
4+
import chalk from 'chalk';
5+
import ts from 'typescript';
66
import {config} from './check-mdc-tests-config';
77

88
const srcDirectory = join(__dirname, '../src');

scripts/check-package-externals.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
* be passed to this script to ensure that the list is up-to-date.
99
*/
1010

11-
import * as chalk from 'chalk';
11+
import chalk from 'chalk';
1212
import {readFileSync} from 'fs';
13-
import * as minimatch from 'minimatch';
13+
import minimatch from 'minimatch';
1414
import {join, relative} from 'path';
15-
import * as ts from 'typescript';
15+
import ts from 'typescript';
1616

1717
const projectRoot = join(__dirname, '../');
1818
const args = process.argv.slice(2);

scripts/ownerslint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as chalk from 'chalk';
1+
import chalk from 'chalk';
22
import {readdirSync, readFileSync, statSync} from 'fs';
33
import {IMinimatch, Minimatch} from 'minimatch';
44
import {join} from 'path';

scripts/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"strict": true,
99
"noEmit": true,
1010
"skipLibCheck": true,
11-
"downlevelIteration": true
11+
"downlevelIteration": true,
12+
"esModuleInterop": true
1213
},
1314
// The `firebase-functions` folder has its own `package.json` and does
1415
// not pass type-checking. This excludes it from being checked.

tools/dgeni/common/class-inheritance.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import {ApiDoc} from 'dgeni-packages/typescript/api-doc-types/ApiDoc';
44
import {ClassExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassExportDoc';
55
import {ClassLikeExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassLikeExportDoc';
66
import {InterfaceExportDoc} from 'dgeni-packages/typescript/api-doc-types/InterfaceExportDoc';
7-
import * as ts from 'typescript';
87
import {MemberDoc} from 'dgeni-packages/typescript/api-doc-types/MemberDoc';
98

9+
import ts from 'typescript';
10+
1011
/** Type describing class like documents which have been created through inheritance. */
1112
export type InheritanceCreatedClassLikeDoc = ClassLikeExportDoc & {
1213
_inheritanceCreated?: true;

tools/dgeni/processors/async-functions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {DocCollection, Processor} from 'dgeni';
22
import {ApiDoc} from 'dgeni-packages/typescript/api-doc-types/ApiDoc';
33
import {FunctionExportDoc} from 'dgeni-packages/typescript/api-doc-types/FunctionExportDoc';
44
import {MethodMemberDoc} from 'dgeni-packages/typescript/api-doc-types/MethodMemberDoc';
5-
import * as ts from 'typescript';
5+
6+
import ts from 'typescript';
67

78
/** Type describing a function-like API doc (i.e. a function, or a class method member). */
89
type FunctionLikeDoc = (FunctionExportDoc | MethodMemberDoc) & {

tools/dgeni/processors/categorizer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import ts from 'typescript';
2+
13
import {DocCollection, Processor} from 'dgeni';
24
import {ClassLikeExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassLikeExportDoc';
35
import {MemberDoc} from 'dgeni-packages/typescript/api-doc-types/MemberDoc';
4-
import * as ts from 'typescript';
56
import {getInheritedDocsOfClass} from '../common/class-inheritance';
67
import {
78
decorateDeprecatedDoc,

0 commit comments

Comments
 (0)