Skip to content

Commit a97f7f5

Browse files
committed
build: more type information for docs
* Upgrades dgeni and dgeni-packages to the latest available version (including TypeScript support; and newer TypeScript version for AST) * More warnings if type information is missing on public TypeScript symbol * Adds missing explicit type declarations to all components * Types are now being displayed for accessors and properties (this was broken before somehow) * Rewrote the Dgeni setup in TypeScript for type safety and better integration into the gulp workflow.
1 parent dfe01f2 commit a97f7f5

37 files changed

+1803
-713
lines changed

package-lock.json

Lines changed: 1140 additions & 224 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
"axe-core": "^2.3.1",
6161
"axe-webdriverjs": "^1.1.1",
6262
"chalk": "^1.1.3",
63-
"dgeni": "^0.4.7",
64-
"dgeni-packages": "^0.19.1",
63+
"dgeni": "^0.4.9",
64+
"dgeni-packages": "^0.21.1",
6565
"firebase": "^4.0.0",
6666
"firebase-admin": "^5.0.0",
6767
"firebase-tools": "^3.9.0",

src/cdk/a11y/focus-trap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export class FocusTrapFactory {
279279
private _platform: Platform,
280280
private _ngZone: NgZone) { }
281281

282-
create(element: HTMLElement, deferAnchors = false): FocusTrap {
282+
create(element: HTMLElement, deferAnchors: boolean = false): FocusTrap {
283283
return new FocusTrap(element, this._platform, this._checker, this._ngZone, deferAnchors);
284284
}
285285
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {
5555
* Turns on typeahead mode which allows users to set the active item by typing.
5656
* @param debounceInterval Time to wait after the last keystroke before setting the active item.
5757
*/
58-
withTypeAhead(debounceInterval = 200): this {
58+
withTypeAhead(debounceInterval: number = 200): this {
5959
if (this._items.length && this._items.some(item => typeof item.getLabel !== 'function')) {
6060
throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.');
6161
}

src/cdk/observers/observe-content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {RxChain, debounceTime} from '@angular/cdk/rxjs';
2727
*/
2828
@Injectable()
2929
export class MdMutationObserverFactory {
30-
create(callback): MutationObserver | null {
30+
create(callback: MutationCallback): MutationObserver | null {
3131
return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
3232
}
3333
}

src/cdk/overlay/position/connected-position-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class ConnectedPositionStrategy implements PositionStrategy {
8181
}
8282

8383
/** Ordered list of preferred positions, from most to least desirable. */
84-
get positions() {
84+
get positions(): ConnectionPositionPair[] {
8585
return this._preferredPositions;
8686
}
8787

src/cdk/overlay/position/global-position-strategy.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
4141
* Sets the top position of the overlay. Clears any previously set vertical position.
4242
* @param value New top offset.
4343
*/
44-
top(value = ''): this {
44+
top(value: string = ''): this {
4545
this._bottomOffset = '';
4646
this._topOffset = value;
4747
this._alignItems = 'flex-start';
@@ -52,7 +52,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
5252
* Sets the left position of the overlay. Clears any previously set horizontal position.
5353
* @param value New left offset.
5454
*/
55-
left(value = ''): this {
55+
left(value: string = ''): this {
5656
this._rightOffset = '';
5757
this._leftOffset = value;
5858
this._justifyContent = 'flex-start';
@@ -63,7 +63,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
6363
* Sets the bottom position of the overlay. Clears any previously set vertical position.
6464
* @param value New bottom offset.
6565
*/
66-
bottom(value = ''): this {
66+
bottom(value: string = ''): this {
6767
this._topOffset = '';
6868
this._bottomOffset = value;
6969
this._alignItems = 'flex-end';
@@ -74,7 +74,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
7474
* Sets the right position of the overlay. Clears any previously set horizontal position.
7575
* @param value New right offset.
7676
*/
77-
right(value = ''): this {
77+
right(value: string = ''): this {
7878
this._leftOffset = '';
7979
this._rightOffset = value;
8080
this._justifyContent = 'flex-end';
@@ -85,7 +85,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
8585
* Sets the overlay width and clears any previously set width.
8686
* @param value New width for the overlay
8787
*/
88-
width(value = ''): this {
88+
width(value: string = ''): this {
8989
this._width = value;
9090

9191
// When the width is 100%, we should reset the `left` and the offset,
@@ -101,7 +101,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
101101
* Sets the overlay height and clears any previously set height.
102102
* @param value New height for the overlay
103103
*/
104-
height(value = ''): this {
104+
height(value: string = ''): this {
105105
this._height = value;
106106

107107
// When the height is 100%, we should reset the `top` and the offset,
@@ -119,7 +119,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
119119
*
120120
* @param offset Overlay offset from the horizontal center.
121121
*/
122-
centerHorizontally(offset = ''): this {
122+
centerHorizontally(offset: string = ''): this {
123123
this.left(offset);
124124
this._justifyContent = 'center';
125125
return this;
@@ -131,7 +131,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
131131
*
132132
* @param offset Overlay offset from the vertical center.
133133
*/
134-
centerVertically(offset = ''): this {
134+
centerVertically(offset: string = ''): this {
135135
this.top(offset);
136136
this._alignItems = 'center';
137137
return this;

src/cdk/scrolling/viewport-ruler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class ViewportRuler {
2626
}
2727

2828
/** Gets a ClientRect for the viewport's bounds. */
29-
getViewportRect(documentRect = this._documentRect): ClientRect {
29+
getViewportRect(documentRect: ClientRect | undefined = this._documentRect): ClientRect {
3030
// Cache the document bounding rect so that we don't recompute it for multiple calls.
3131
if (!documentRect) {
3232
this._cacheViewportGeometry();
@@ -61,7 +61,7 @@ export class ViewportRuler {
6161
* Gets the (top, left) scroll position of the viewport.
6262
* @param documentRect
6363
*/
64-
getViewportScrollPosition(documentRect = this._documentRect) {
64+
getViewportScrollPosition(documentRect: ClientRect | undefined = this._documentRect) {
6565
// Cache the document bounding rect so that we don't recompute it for multiple calls.
6666
if (!documentRect) {
6767
this._cacheViewportGeometry();

src/lib/button-toggle/button-toggle.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class MdButtonToggleGroup extends _MdButtonToggleGroupMixinBase
9393
_controlValueAccessorChangeFn: (value: any) => void = () => {};
9494

9595
/** onTouch function registered via registerOnTouch (ControlValueAccessor). */
96-
onTouched: () => any = () => {};
96+
_onTouched: () => any = () => {};
9797

9898
/** Child button toggle buttons. */
9999
@ContentChildren(forwardRef(() => MdButtonToggle)) _buttonToggles: QueryList<MdButtonToggle>;
@@ -214,7 +214,7 @@ export class MdButtonToggleGroup extends _MdButtonToggleGroupMixinBase
214214
* @param fn On touch callback function.
215215
*/
216216
registerOnTouched(fn: any) {
217-
this.onTouched = fn;
217+
this._onTouched = fn;
218218
}
219219

220220
/**
@@ -427,7 +427,7 @@ export class MdButtonToggle implements OnInit, OnDestroy {
427427
let groupValueChanged = this.buttonToggleGroup.selected != this;
428428
this.checked = true;
429429
this.buttonToggleGroup.selected = this;
430-
this.buttonToggleGroup.onTouched();
430+
this.buttonToggleGroup._onTouched();
431431
if (groupValueChanged) {
432432
this.buttonToggleGroup._emitChangeEvent();
433433
}

src/lib/chips/chip-input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class MdChipInput {
4141
* Whether or not the chipEnd event will be emitted when the input is blurred.
4242
*/
4343
@Input('mdChipInputAddOnBlur')
44-
get addOnBlur() { return this._addOnBlur; }
44+
get addOnBlur(): boolean { return this._addOnBlur; }
4545
set addOnBlur(value) { this._addOnBlur = coerceBooleanProperty(value); }
4646
_addOnBlur: boolean = false;
4747

@@ -61,7 +61,7 @@ export class MdChipInput {
6161
set matChipList(value: MdChipList) { this.chipList = value; }
6262

6363
@Input('matChipInputAddOnBlur')
64-
get matAddOnBlur() { return this._addOnBlur; }
64+
get matAddOnBlur(): boolean { return this._addOnBlur; }
6565
set matAddOnBlur(value) { this.addOnBlur = value; }
6666

6767
@Input('matChipInputSeparatorKeyCodes')

0 commit comments

Comments
 (0)