Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

fix: Set correct type of ImplicitAny members #136

Merged
merged 9 commits into from
Sep 8, 2017
Merged
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
2,040 changes: 543 additions & 1,497 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"devDependencies": {
"@angular/compiler-cli": "^4.3.6",
"@angular/flex-layout": "^2.0.0-beta.8",
"@types/node": "^8.0.21",
"@types/node": "^8.0.27",
"angular2-template-loader": "^0.6.2",
"autoprefixer": "^7.1.2",
"awesome-typescript-loader": "^3.2.3",
Expand Down Expand Up @@ -90,7 +90,7 @@
"stylelint-scss": "^2.0.1",
"tslint": "^5.7.0",
"tslint-eslint-rules": "^4.1.1",
"typescript": "^2.4.2",
"typescript": "^2.5.2",
"typings": "^2.1.1",
"uglify-es": "^3.0.27",
"validate-commit-msg": "^2.14.0",
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/components/fab-demo/fab-demo.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div fxLayout="column" fxLayoutAlign="start start" class="mdc-padding">
<h1 mdc-typography-display1>Floating Action Buttons</h1>
<h1 mdc-typography-display1>Floating Action Button</h1>
<div mdc-typography-subheading2>The MDC FAB component is a spec-aligned button component adhering to the Material Design button requirements.</div>
<div class="info-banner" mdc-typography-subheading1>
<![CDATA[import { MdcFabModule } from '@angular-mdc/web';]]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h1 mdc-typography-display1>Icon Toggle Buttons</h1>
<tbody>
<tr>
<td>
<pre><code><![CDATA[change(evtData {isOn: boolean})]]></code></pre>
<pre><code><![CDATA[change(isOn: boolean)]]></code></pre>
</td>
<td>Broadcast when a user toggles the button.</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import {
Component,
} from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'textfield-demo',
templateUrl: './textfield-demo.component.html'
})
export class TextfieldDemoComponent {
username = null;
prefill = 'John Doe';
password = null;
comments = null;
subject = null;
message = null;
username: string = '';
prefill:string = 'John Doe';
comments:string;
subject:string;
message:string;
isDisabled = false;
isRequired = true;
isDense = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class ToolbarDemoComponent {
isFixedLastRow = false;
flexibleExpansionRatio: number;

handleToolbarChange(evt) {
handleToolbarChange(evt: number) {
this.flexibleExpansionRatio = evt;
}
}
4 changes: 3 additions & 1 deletion src/demo-app/tsconfig-build-aot.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"lib": ["es2015", "dom"],
"declaration": false,
"sourceMap": true,
"noImplicitAny": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"suppressImplicitAnyIndexErrors": true,
Expand All @@ -14,7 +15,8 @@
},
"files": [
"app.module.ts",
"main-aot.ts"
"main-aot.ts",
"../lib/typings.d.ts"
],
"exclude": [
"node_modules",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/button/button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export class MdcButtonComponent {
@HostBinding('class.mdc-button--stroked') get classStroked(): string {
return this.stroked ? 'mdc-button--stroked' : '';
}
@HostListener('keypress', ['$event']) onkeypress(evt) {
@HostListener('keypress', ['$event']) onkeypress(evt: KeyboardEvent) {
this.handleKeyPress_(evt);
}
@HostListener('blur', ['$event']) blur(evt) {
@HostListener('blur', ['$event']) blur(evt: FocusEvent) {
this.handleBlur_(evt);
}

Expand Down
8 changes: 4 additions & 4 deletions src/lib/checkbox/checkbox-adapter.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export interface MDCCheckboxAdapter {
addClass: (className: string) => void;
removeClass: (className: string) => void;
registerAnimationEndHandler: (EventListener) => void;
deregisterAnimationEndHandler: (EventListener) => void;
registerChangeHandler: (EventListener) => void;
deregisterChangeHandler: (EventListener) => void;
registerAnimationEndHandler: (handler: EventListener) => void;
deregisterAnimationEndHandler: (handler: EventListener) => void;
registerChangeHandler: (handler: EventListener) => void;
deregisterChangeHandler: (handler: EventListener) => void;
getNativeControl: () => { checked: boolean, indeterminate: boolean };
forceLayout: () => void;
isAttachedToDOM: () => boolean;
Expand Down
1 change: 1 addition & 0 deletions src/lib/common/keycodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export enum KeyCodes {
SPACE = 32,
ENTER = 13,
TAB = 9,
ESCAPE = 27,
}
9 changes: 6 additions & 3 deletions src/lib/dialog/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import { MdcButtonComponent } from '../button/button.component';
import { MDCDialogAdapter } from './dialog-adapter';
import { MDCDialogFoundation } from '@material/dialog';

export { focusTrap };

@Directive({
selector: '[mdc-dialog-surface], mdc-dialog-surface'
})
Expand Down Expand Up @@ -129,7 +127,12 @@ export class MdcDialogButtonDirective extends MdcButtonComponent {
encapsulation: ViewEncapsulation.None
})
export class MdcDialogComponent implements AfterViewInit, OnDestroy {
private focusTrap_: any;
private focusTrap_: {
activate: Function;
deactivate: Function;
pause: Function;
unpause: Function;
};

@Input() clickOutsideToClose: boolean = true;
@Output('accept') accept_: EventEmitter<string> = new EventEmitter();
Expand Down
4 changes: 2 additions & 2 deletions src/lib/fab/fab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export class MdcFabComponent {
@HostBinding('class.mdc-fab--mini') get classMini(): string {
return this.mini ? 'mdc-fab--mini' : '';
}
@HostListener('keypress', ['$event']) onkeypress(evt) {
@HostListener('keypress', ['$event']) onkeypress(evt: KeyboardEvent) {
this.handleKeyPress(evt);
}
@HostListener('blur', ['$event']) blur(evt) {
@HostListener('blur', ['$event']) blur(evt: FocusEvent) {
this.handleBlur(evt);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/icon-toggle/adapter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export interface MDCIconToggleAdapter {
getAttr: (name: string) => string;
setAttr: (name: string, value: string) => void;
rmAttr: (name: string) => void;
notifyChange: (evtData) => void;
notifyChange: (evtData: { isOn: boolean }) => void;
}
6 changes: 3 additions & 3 deletions src/lib/icon-toggle/icon-toggle.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class MdcIconToggleComponent implements AfterViewInit, OnChanges, OnDestr
set disableRipple(value) {
this._ripple.disabled = toBoolean(value);
}
@Output('change') change_: EventEmitter<Event> = new EventEmitter();
@Output('change') change_: EventEmitter<boolean> = new EventEmitter();
@HostBinding('class.mdc-icon-toggle') isHostClass = true;
@HostBinding('attr.role') role: string = 'button';
@HostBinding('attr.aria-pressed') ariaPressed: string = 'false';
Expand Down Expand Up @@ -114,9 +114,9 @@ export class MdcIconToggleComponent implements AfterViewInit, OnChanges, OnDestr
getAttr: (name) => this._root.nativeElement.getAttribute(name),
setAttr: (name, value) => this._renderer.setAttribute(this._root.nativeElement, name, value),
rmAttr: (name) => this._renderer.removeAttribute(this._root.nativeElement, name),
notifyChange: (evtData) => {
notifyChange: (evtData: { isOn: boolean }) => {
this._controlValueAccessorChangeFn(evtData.isOn);
this.change_.emit(evtData);
this.change_.emit(evtData.isOn);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"main": "./bundles/material.umd.js",
"module": "./material.es5.js",
"es2015": "./material.js",
"typings": "./index.d.ts",
"typings": "./typings.d.ts",
"private": false,
"dependencies": {
"material-components-web": "0.20.0"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/radio/radio-adapter.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface MDCRadioAdapter {
addClass: (className: string) => void;
removeClass: (className: string) => void;
getNativeControl: () => { HTMLInputElement };
getNativeControl: () => HTMLInputElement;
}
10 changes: 4 additions & 6 deletions src/lib/tabs/tab-bar/tab-bar.directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Directive,
ContentChildren,
Directive,
ElementRef,
EventEmitter,
HostBinding,
Expand Down Expand Up @@ -121,17 +121,15 @@ export class MdcTabBarDirective {
this.unlistenTabSelect();
}
this.tabEvents = new Array<Subscription>();
this.tabs.forEach(_ => {
this.tabEvents.push(_.select.subscribe(event => {
this.tabs.forEach(tab => {
this.tabEvents.push(tab.select.subscribe((event: any) => {
this._foundation.switchToTabAtIndex(this.tabs.toArray().indexOf(event.tab), true);
}));
});
}

private unlistenTabSelect() {
this.tabEvents.forEach(_ =>
_.unsubscribe()
);
this.tabEvents.forEach(_ => _.unsubscribe());
this.tabEvents = null;
}
}
4 changes: 2 additions & 2 deletions src/lib/toolbar/toolbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export class MdcToolbarComponent implements AfterViewInit, OnDestroy {
@Input() waterfall: boolean;
@Input() fixedLastrow: boolean;
@Output() change: EventEmitter<number> = new EventEmitter<number>();
@ContentChild(MdcToolbarRowDirective) mdcFirstRow;
@ContentChild(MdcToolbarTitleDirective) mdcTitle;
@ContentChild(MdcToolbarRowDirective) mdcFirstRow: MdcToolbarRowDirective;
@ContentChild(MdcToolbarTitleDirective) mdcTitle: MdcToolbarTitleDirective;
@HostBinding('class.mdc-toolbar') isHostClass = true;
@HostBinding('class.mdc-toolbar--fixed') get classFixedToolbar(): string {
return this.fixed ? 'mdc-toolbar--fixed' : '';
Expand Down
4 changes: 3 additions & 1 deletion src/lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"baseUrl": ".",
"noUnusedParameters": false,
"sourceMap": true,
"noImplicitAny": true,
"importHelpers": true,
"emitDecoratorMetadata": true,
"inlineSources": true,
Expand All @@ -19,7 +20,8 @@
"noStrictGenericChecks": true
},
"files": [
"public_api.ts"
"public_api.ts",
"typings.d.ts"
],
"compileOnSave": false,
"buildOnSave": false,
Expand Down
17 changes: 17 additions & 0 deletions src/lib/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
declare module '@material/ripple/util';
declare module '@material/ripple';
declare module '@material/dialog';
declare module '@material/drawer';
declare module '@material/form-field';
declare module '@material/icon-toggle';
declare module '@material/radio';
declare module '@material/checkbox';
declare module '@material/linear-progress';
declare module '@material/menu/util';
declare module '@material/menu/simple';
declare module '@material/snackbar';
declare module '@material/tabs';
declare module '@material/animation';
declare module '@material/textfield';
declare module '@material/toolbar';
declare module 'focus-trap';