chore: add support for noImplicitThis (#13404)

This commit is contained in:
Kristiyan Kostadinov
2018-10-17 17:02:17 +03:00
committed by Joey Perrott
parent 5c8e0cbc95
commit 97703be459
21 changed files with 30 additions and 10 deletions
+1
View File
@@ -7,6 +7,7 @@
"experimentalDecorators": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"inlineSources": true,
"lib": ["es2015"],
"module": "commonjs",
+1 -1
View File
@@ -34,6 +34,6 @@ export function expectLocation(element: FinderResult, {x, y}: Point): void {
*/
export function expectAlignedWith(element: FinderResult, otherElement: FinderResult): void {
getElement(otherElement).getLocation().then((location: Point) => {
this.expectLocation(getElement(element), location);
expectLocation(getElement(element), location);
});
}
+1
View File
@@ -13,6 +13,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"importHelpers": true,
"newLine": "lf",
"module": "es2015",
+1
View File
@@ -9,6 +9,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"importHelpers": true,
"newLine": "lf",
"module": "es2015",
@@ -509,7 +509,7 @@ describe('InteractivityChecker', () => {
}
}
function runIf(condition: boolean, runFn: Function): () => void {
function runIf(this: any, condition: boolean, runFn: Function): () => void {
return (...args: any[]) => {
if (condition) {
runFn.apply(this, args);
@@ -37,6 +37,10 @@ class FakeQueryList<T> extends QueryList<T> {
notifyOnChanges() { this.changes.next(this); }
}
interface KeyEventTestContext {
nextKeyEvent: KeyboardEvent;
prevKeyEvent: KeyboardEvent;
}
describe('Key managers', () => {
let itemList: FakeQueryList<any>;
@@ -164,7 +168,7 @@ describe('Key managers', () => {
expect(fakeKeyEvents.downArrow.defaultPrevented).toBe(false);
});
describe('with `vertical` direction', () => {
describe('with `vertical` direction', function(this: KeyEventTestContext) {
beforeEach(() => {
keyManager.withVerticalOrientation();
this.nextKeyEvent = createKeyboardEvent('keydown', DOWN_ARROW);
@@ -174,7 +178,7 @@ describe('Key managers', () => {
runDirectionalKeyTests.call(this);
});
describe('with `ltr` direction', () => {
describe('with `ltr` direction', function(this: KeyEventTestContext) {
beforeEach(() => {
keyManager.withHorizontalOrientation('ltr');
this.nextKeyEvent = createKeyboardEvent('keydown', RIGHT_ARROW);
@@ -184,7 +188,7 @@ describe('Key managers', () => {
runDirectionalKeyTests.call(this);
});
describe('with `rtl` direction', () => {
describe('with `rtl` direction', function(this: KeyEventTestContext) {
beforeEach(() => {
keyManager.withHorizontalOrientation('rtl');
this.nextKeyEvent = createKeyboardEvent('keydown', LEFT_ARROW);
@@ -199,7 +203,7 @@ describe('Key managers', () => {
* parameters have to be passed in via Jasmine's context object (`this` inside a `beforeEach`)
* because this function has to run before any `beforeEach`, `beforeAll` etc. hooks.
*/
function runDirectionalKeyTests() {
function runDirectionalKeyTests(this: KeyEventTestContext) {
it('should set subsequent items as active when the next key is pressed', () => {
keyManager.onKeydown(this.nextKeyEvent);
+1
View File
@@ -10,6 +10,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"outDir": "../../dist/packages/demo-app",
"rootDirs": [
".",
+1
View File
@@ -10,6 +10,7 @@
"noUnusedParameters": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"lib": ["es6", "es2015", "dom"],
"skipLibCheck": true,
"module": "commonjs",
+1
View File
@@ -10,6 +10,7 @@
// strict-null compliant.
"strictNullChecks": false,
"strictFunctionTypes": true,
"noImplicitThis": true,
"lib": ["es6", "es2015", "dom"],
"module": "commonjs",
"moduleResolution": "node",
+1
View File
@@ -8,6 +8,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"importHelpers": true,
"newLine": "lf",
"module": "es2015",
@@ -11,6 +11,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"importHelpers": true,
"module": "es2015",
"moduleResolution": "node",
@@ -9,6 +9,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"importHelpers": true,
"newLine": "lf",
"module": "es2015",
@@ -11,6 +11,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"importHelpers": true,
"newLine": "lf",
"module": "es2015",
+1
View File
@@ -9,6 +9,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": ".",
@@ -8,6 +8,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": ".",
+1 -1
View File
@@ -38,7 +38,7 @@ function patchTestBedToDestroyFixturesAfterEveryTest(testBedInstance: TestBed) {
// Monkey-patch the resetTestingModule to destroy fixtures outside of a try/catch block.
// With https://github.com/angular/angular/commit/2c5a67134198a090a24f6671dcdb7b102fea6eba
// errors when destroying components are no longer causing Jasmine to fail.
testBedInstance.resetTestingModule = function() {
testBedInstance.resetTestingModule = function(this: {_activeFixtures: ComponentFixture<any>[]}) {
try {
this._activeFixtures.forEach((fixture: ComponentFixture<any>) => fixture.destroy());
} finally {
+1
View File
@@ -7,6 +7,7 @@
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"sourceMap": true,
"target": "es5",
"baseUrl": "",
+1
View File
@@ -8,6 +8,7 @@
"outDir": "../../dist/tools/dgeni",
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noEmitOnError": true,
"noImplicitAny": true,
"target": "es5",
+3 -3
View File
@@ -204,11 +204,11 @@ function fixMarkdownDocLinks(link: string, filePath: string): string {
* @param classPrefix The prefix to use for the alias class.
*/
function createTagNameAliaser(classPrefix: string) {
return function() {
return function(this: HTMLElement) {
MARKDOWN_TAGS_TO_CLASS_ALIAS.forEach(tag => {
for (let el of this.querySelectorAll(tag)) {
Array.from(this.querySelectorAll(tag)).forEach(el => {
el.classList.add(`${classPrefix}-${tag}`);
}
});
});
return this;
+1
View File
@@ -8,6 +8,7 @@
"outDir": "../../dist/tools/gulp",
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noEmitOnError": true,
"noImplicitAny": true,
"target": "es5",
+1
View File
@@ -10,6 +10,7 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"skipLibCheck": true,
"target": "es2015",
"lib": ["es5", "es2015", "dom"],