Skip to content

Commit 97703be

Browse files
crisbetojosephperrott
authored andcommitted
chore: add support for noImplicitThis (#13404)
1 parent 5c8e0cb commit 97703be

File tree

21 files changed

+30
-10
lines changed

21 files changed

+30
-10
lines changed

e2e/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"experimentalDecorators": true,
88
"strictNullChecks": true,
99
"strictFunctionTypes": true,
10+
"noImplicitThis": true,
1011
"inlineSources": true,
1112
"lib": ["es2015"],
1213
"module": "commonjs",

e2e/util/asserts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ export function expectLocation(element: FinderResult, {x, y}: Point): void {
3434
*/
3535
export function expectAlignedWith(element: FinderResult, otherElement: FinderResult): void {
3636
getElement(otherElement).getLocation().then((location: Point) => {
37-
this.expectLocation(getElement(element), location);
37+
expectLocation(getElement(element), location);
3838
});
3939
}

src/bazel-tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"strictNullChecks": true,
1414
"strictFunctionTypes": true,
1515
"noImplicitAny": true,
16+
"noImplicitThis": true,
1617
"importHelpers": true,
1718
"newLine": "lf",
1819
"module": "es2015",

src/cdk-experimental/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"strictNullChecks": true,
1010
"strictFunctionTypes": true,
1111
"noImplicitAny": true,
12+
"noImplicitThis": true,
1213
"importHelpers": true,
1314
"newLine": "lf",
1415
"module": "es2015",

src/cdk/a11y/interactivity-checker/interactivity-checker.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ describe('InteractivityChecker', () => {
509509
}
510510
}
511511

512-
function runIf(condition: boolean, runFn: Function): () => void {
512+
function runIf(this: any, condition: boolean, runFn: Function): () => void {
513513
return (...args: any[]) => {
514514
if (condition) {
515515
runFn.apply(this, args);

src/cdk/a11y/key-manager/list-key-manager.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class FakeQueryList<T> extends QueryList<T> {
3737
notifyOnChanges() { this.changes.next(this); }
3838
}
3939

40+
interface KeyEventTestContext {
41+
nextKeyEvent: KeyboardEvent;
42+
prevKeyEvent: KeyboardEvent;
43+
}
4044

4145
describe('Key managers', () => {
4246
let itemList: FakeQueryList<any>;
@@ -164,7 +168,7 @@ describe('Key managers', () => {
164168
expect(fakeKeyEvents.downArrow.defaultPrevented).toBe(false);
165169
});
166170

167-
describe('with `vertical` direction', () => {
171+
describe('with `vertical` direction', function(this: KeyEventTestContext) {
168172
beforeEach(() => {
169173
keyManager.withVerticalOrientation();
170174
this.nextKeyEvent = createKeyboardEvent('keydown', DOWN_ARROW);
@@ -174,7 +178,7 @@ describe('Key managers', () => {
174178
runDirectionalKeyTests.call(this);
175179
});
176180

177-
describe('with `ltr` direction', () => {
181+
describe('with `ltr` direction', function(this: KeyEventTestContext) {
178182
beforeEach(() => {
179183
keyManager.withHorizontalOrientation('ltr');
180184
this.nextKeyEvent = createKeyboardEvent('keydown', RIGHT_ARROW);
@@ -184,7 +188,7 @@ describe('Key managers', () => {
184188
runDirectionalKeyTests.call(this);
185189
});
186190

187-
describe('with `rtl` direction', () => {
191+
describe('with `rtl` direction', function(this: KeyEventTestContext) {
188192
beforeEach(() => {
189193
keyManager.withHorizontalOrientation('rtl');
190194
this.nextKeyEvent = createKeyboardEvent('keydown', LEFT_ARROW);
@@ -199,7 +203,7 @@ describe('Key managers', () => {
199203
* parameters have to be passed in via Jasmine's context object (`this` inside a `beforeEach`)
200204
* because this function has to run before any `beforeEach`, `beforeAll` etc. hooks.
201205
*/
202-
function runDirectionalKeyTests() {
206+
function runDirectionalKeyTests(this: KeyEventTestContext) {
203207
it('should set subsequent items as active when the next key is pressed', () => {
204208
keyManager.onKeydown(this.nextKeyEvent);
205209

src/demo-app/tsconfig-aot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"strictNullChecks": true,
1111
"strictFunctionTypes": true,
1212
"noImplicitAny": true,
13+
"noImplicitThis": true,
1314
"outDir": "../../dist/packages/demo-app",
1415
"rootDirs": [
1516
".",

src/demo-app/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"noUnusedParameters": true,
1111
"strictNullChecks": true,
1212
"strictFunctionTypes": true,
13+
"noImplicitThis": true,
1314
"lib": ["es6", "es2015", "dom"],
1415
"skipLibCheck": true,
1516
"module": "commonjs",

src/e2e-app/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// strict-null compliant.
1111
"strictNullChecks": false,
1212
"strictFunctionTypes": true,
13+
"noImplicitThis": true,
1314
"lib": ["es6", "es2015", "dom"],
1415
"module": "commonjs",
1516
"moduleResolution": "node",

src/lib/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"strictNullChecks": true,
99
"strictFunctionTypes": true,
1010
"noImplicitAny": true,
11+
"noImplicitThis": true,
1112
"importHelpers": true,
1213
"newLine": "lf",
1314
"module": "es2015",

src/material-examples/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"strictNullChecks": true,
1212
"strictFunctionTypes": true,
1313
"noImplicitAny": true,
14+
"noImplicitThis": true,
1415
"importHelpers": true,
1516
"module": "es2015",
1617
"moduleResolution": "node",

src/material-experimental/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"strictNullChecks": true,
1010
"strictFunctionTypes": true,
1111
"noImplicitAny": true,
12+
"noImplicitThis": true,
1213
"importHelpers": true,
1314
"newLine": "lf",
1415
"module": "es2015",

src/material-moment-adapter/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"strictNullChecks": true,
1212
"strictFunctionTypes": true,
1313
"noImplicitAny": true,
14+
"noImplicitThis": true,
1415
"importHelpers": true,
1516
"newLine": "lf",
1617
"module": "es2015",

src/universal-app/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"strictNullChecks": true,
1010
"strictFunctionTypes": true,
1111
"noImplicitAny": true,
12+
"noImplicitThis": true,
1213
"module": "commonjs",
1314
"moduleResolution": "node",
1415
"outDir": ".",

src/universal-app/tsconfig-prerender.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"strictNullChecks": true,
99
"strictFunctionTypes": true,
1010
"noImplicitAny": true,
11+
"noImplicitThis": true,
1112
"module": "commonjs",
1213
"moduleResolution": "node",
1314
"outDir": ".",

test/angular-test-init-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function patchTestBedToDestroyFixturesAfterEveryTest(testBedInstance: TestBed) {
3838
// Monkey-patch the resetTestingModule to destroy fixtures outside of a try/catch block.
3939
// With https://github.com/angular/angular/commit/2c5a67134198a090a24f6671dcdb7b102fea6eba
4040
// errors when destroying components are no longer causing Jasmine to fail.
41-
testBedInstance.resetTestingModule = function() {
41+
testBedInstance.resetTestingModule = function(this: {_activeFixtures: ComponentFixture<any>[]}) {
4242
try {
4343
this._activeFixtures.forEach((fixture: ComponentFixture<any>) => fixture.destroy());
4444
} finally {

tools/dashboard/functions/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"noImplicitAny": true,
88
"strictNullChecks": true,
99
"strictFunctionTypes": true,
10+
"noImplicitThis": true,
1011
"sourceMap": true,
1112
"target": "es5",
1213
"baseUrl": "",

tools/dgeni/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"outDir": "../../dist/tools/dgeni",
99
"strictNullChecks": true,
1010
"strictFunctionTypes": true,
11+
"noImplicitThis": true,
1112
"noEmitOnError": true,
1213
"noImplicitAny": true,
1314
"target": "es5",

tools/gulp/tasks/docs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ function fixMarkdownDocLinks(link: string, filePath: string): string {
204204
* @param classPrefix The prefix to use for the alias class.
205205
*/
206206
function createTagNameAliaser(classPrefix: string) {
207-
return function() {
207+
return function(this: HTMLElement) {
208208
MARKDOWN_TAGS_TO_CLASS_ALIAS.forEach(tag => {
209-
for (let el of this.querySelectorAll(tag)) {
209+
Array.from(this.querySelectorAll(tag)).forEach(el => {
210210
el.classList.add(`${classPrefix}-${tag}`);
211-
}
211+
});
212212
});
213213

214214
return this;

tools/gulp/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"outDir": "../../dist/tools/gulp",
99
"strictNullChecks": true,
1010
"strictFunctionTypes": true,
11+
"noImplicitThis": true,
1112
"noEmitOnError": true,
1213
"noImplicitAny": true,
1314
"target": "es5",

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"strictNullChecks": true,
1111
"strictFunctionTypes": true,
1212
"noImplicitAny": true,
13+
"noImplicitThis": true,
1314
"skipLibCheck": true,
1415
"target": "es2015",
1516
"lib": ["es5", "es2015", "dom"],

0 commit comments

Comments
 (0)