Skip to content

Commit 388845c

Browse files
devversionkara
authored andcommitted
build: more type information for docs (#6947)
1 parent a774688 commit 388845c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3282
-993
lines changed

package-lock.json

Lines changed: 2604 additions & 495 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.11.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 MatMutationObserverFactory {
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
@@ -94,7 +94,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
9494
_controlValueAccessorChangeFn: (value: any) => void = () => {};
9595

9696
/** onTouch function registered via registerOnTouch (ControlValueAccessor). */
97-
onTouched: () => any = () => {};
97+
_onTouched: () => any = () => {};
9898

9999
/** Child button toggle buttons. */
100100
@ContentChildren(forwardRef(() => MatButtonToggle)) _buttonToggles: QueryList<MatButtonToggle>;
@@ -215,7 +215,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
215215
* @param fn On touch callback function.
216216
*/
217217
registerOnTouched(fn: any) {
218-
this.onTouched = fn;
218+
this._onTouched = fn;
219219
}
220220

221221
/**
@@ -436,7 +436,7 @@ export class MatButtonToggle implements OnInit, OnDestroy {
436436
let groupValueChanged = this.buttonToggleGroup.selected != this;
437437
this.checked = true;
438438
this.buttonToggleGroup.selected = this;
439-
this.buttonToggleGroup.onTouched();
439+
this.buttonToggleGroup._onTouched();
440440
if (groupValueChanged) {
441441
this.buttonToggleGroup._emitChangeEvent();
442442
}

src/lib/chips/chip-input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class MatChipInput {
4848
*/
4949
@Input('matChipInputAddOnBlur')
5050
get addOnBlur() { return this._addOnBlur; }
51-
set addOnBlur(value) { this._addOnBlur = coerceBooleanProperty(value); }
51+
set addOnBlur(value: boolean) { this._addOnBlur = coerceBooleanProperty(value); }
5252
_addOnBlur: boolean = false;
5353

5454
/**

src/lib/chips/chip-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export class MatChipList implements MatFormFieldControl<any>, ControlValueAccess
229229
}
230230

231231
/** Whether any chips or the matChipInput inside of this chip-list has focus. */
232-
get focused() {
232+
get focused(): boolean {
233233
return this.chips.some(chip => chip._hasFocus) ||
234234
(this._chipInput && this._chipInput.focused);
235235
}

src/lib/core/option/option.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class MatOption {
7979
}
8080

8181
/** The unique ID of the option. */
82-
get id() { return this._id; }
82+
get id(): string { return this._id; }
8383

8484
/** Whether or not the option is currently selected. */
8585
get selected(): boolean { return this._selected; }

src/lib/core/ripple/ripple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class MatRipple implements OnChanges, OnDestroy {
113113
}
114114

115115
/** Launches a manual ripple at the specified position. */
116-
launch(x: number, y: number, config = this.rippleConfig): RippleRef {
116+
launch(x: number, y: number, config: RippleConfig = this.rippleConfig): RippleRef {
117117
return this._rippleRenderer.fadeInRipple(x, y, config);
118118
}
119119

src/lib/datepicker/datepicker-toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class MatDatepickerToggle<D> implements OnChanges, OnDestroy {
4343

4444
/** Whether the toggle button is disabled. */
4545
@Input()
46-
get disabled() {
46+
get disabled(): boolean {
4747
return this._disabled === undefined ? this.datepicker.disabled : this._disabled;
4848
}
4949
set disabled(value) {

src/lib/dialog/dialog-ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class MatDialogRef<T> {
144144
* @param width New width of the dialog.
145145
* @param height New height of the dialog.
146146
*/
147-
updateSize(width = 'auto', height = 'auto'): this {
147+
updateSize(width: string = 'auto', height: string = 'auto'): this {
148148
this._getPositionStrategy().width(width).height(height);
149149
this._overlayRef.updatePosition();
150150
return this;

src/lib/form-field/form-field.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class MatFormField implements AfterViewInit, AfterContentInit, AfterConte
9999

100100
/** @deprecated Use `color` instead. */
101101
@Input()
102-
get dividerColor() { return this.color; }
102+
get dividerColor(): 'primary' | 'accent' | 'warn' { return this.color; }
103103
set dividerColor(value) { this.color = value; }
104104

105105
/** Whether the required marker should be hidden. */

src/lib/grid-list/grid-tile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ export class MatGridTile {
4141

4242
/** Amount of rows that the grid tile takes up. */
4343
@Input()
44-
get rowspan() { return this._rowspan; }
44+
get rowspan(): number { return this._rowspan; }
4545
set rowspan(value) { this._rowspan = coerceToNumber(value); }
4646

4747
/** Amount of columns that the grid tile takes up. */
4848
@Input()
49-
get colspan() { return this._colspan; }
49+
get colspan(): number { return this._colspan; }
5050
set colspan(value) { this._colspan = coerceToNumber(value); }
5151

5252
/**

src/lib/icon/icon-registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class MatIconRegistry {
148148
* @param alias Alias for the font.
149149
* @param className Class name override to be used instead of the alias.
150150
*/
151-
registerFontClassAlias(alias: string, className = alias): this {
151+
registerFontClassAlias(alias: string, className: string = alias): this {
152152
this._fontCssClassesByAlias.set(alias, className);
153153
return this;
154154
}
@@ -215,7 +215,7 @@ export class MatIconRegistry {
215215
* @param name Name of the icon to be retrieved.
216216
* @param namespace Namespace in which to look for the icon.
217217
*/
218-
getNamedSvgIcon(name: string, namespace = ''): Observable<SVGElement> {
218+
getNamedSvgIcon(name: string, namespace: string = ''): Observable<SVGElement> {
219219
// Return (copy of) cached icon if possible.
220220
const key = iconKey(namespace, name);
221221
const config = this._svgIconConfigs.get(key);

src/lib/menu/menu-directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export class MatMenu implements AfterContentInit, MatMenuPanel, OnDestroy {
209209
* It's necessary to set position-based classes to ensure the menu panel animation
210210
* folds out from the correct direction.
211211
*/
212-
setPositionClasses(posX = this.xPosition, posY = this.yPosition): void {
212+
setPositionClasses(posX: MenuPositionX = this.xPosition, posY: MenuPositionY = this.yPosition) {
213213
this._classList['mat-menu-before'] = posX === 'before';
214214
this._classList['mat-menu-after'] = posX === 'after';
215215
this._classList['mat-menu-above'] = posY === 'above';

src/lib/radio/radio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class MatRadioGroup extends _MatRadioGroupMixinBase
155155

156156
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
157157
@Input()
158-
get labelPosition() {
158+
get labelPosition(): 'before' | 'after' {
159159
return this._labelPosition;
160160
}
161161

src/lib/select/select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,5 +1205,5 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
12051205
}
12061206

12071207
// Implemented as part of MatFormFieldControl.
1208-
get shouldPlaceholderFloat() { return this._panelOpen || !this.empty; }
1208+
get shouldPlaceholderFloat(): boolean { return this._panelOpen || !this.empty; }
12091209
}

src/lib/sidenav/drawer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
137137

138138
/** The side that the drawer is attached to. */
139139
@Input()
140-
get position() { return this._position; }
140+
get position(): 'start' | 'end' { return this._position; }
141141
set position(value) {
142142
// Make sure we have a valid value.
143143
value = value === 'end' ? 'end' : 'start';
@@ -151,12 +151,12 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
151151

152152
/** @deprecated */
153153
@Input()
154-
get align() { return this.position; }
154+
get align(): 'start' | 'end' { return this.position; }
155155
set align(value) { this.position = value; }
156156

157157
/** Mode of the drawer; one of 'over', 'push' or 'side'. */
158158
@Input()
159-
get mode() { return this._mode; }
159+
get mode(): 'over' | 'push' | 'side' { return this._mode; }
160160
set mode(value) {
161161
this._mode = value;
162162
this._modeChanged.next();
@@ -206,7 +206,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
206206
*/
207207
_modeChanged = new Subject();
208208

209-
get _isFocusTrapEnabled() {
209+
get _isFocusTrapEnabled(): boolean {
210210
// The focus trap is only enabled when the drawer is open in any mode other than side.
211211
return this.opened && this.mode !== 'side';
212212
}
@@ -369,10 +369,10 @@ export class MatDrawerContainer implements AfterContentInit, OnDestroy {
369369
@ContentChild(MatDrawerContent) _content: MatDrawerContent;
370370

371371
/** The drawer child with the `start` position. */
372-
get start() { return this._start; }
372+
get start(): MatDrawer | null { return this._start; }
373373

374374
/** The drawer child with the `end` position. */
375-
get end() { return this._end; }
375+
get end(): MatDrawer | null { return this._end; }
376376

377377
/** Event emitted when the drawer backdrop is clicked. */
378378
@Output() backdropClick = new EventEmitter<void>();

src/lib/sidenav/sidenav.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class MatSidenavContent extends MatDrawerContent {
8181
export class MatSidenav extends MatDrawer {
8282
/** Whether the sidenav is fixed in the viewport. */
8383
@Input()
84-
get fixedInViewport() { return this._fixedInViewport; }
84+
get fixedInViewport(): boolean { return this._fixedInViewport; }
8585
set fixedInViewport(value) { this._fixedInViewport = coerceBooleanProperty(value); }
8686
private _fixedInViewport = false;
8787

@@ -90,7 +90,7 @@ export class MatSidenav extends MatDrawer {
9090
* mode.
9191
*/
9292
@Input()
93-
get fixedTopGap() { return this._fixedTopGap; }
93+
get fixedTopGap(): number { return this._fixedTopGap; }
9494
set fixedTopGap(value) { this._fixedTopGap = coerceNumberProperty(value); }
9595
private _fixedTopGap = 0;
9696

@@ -99,7 +99,7 @@ export class MatSidenav extends MatDrawer {
9999
* fixed mode.
100100
*/
101101
@Input()
102-
get fixedBottomGap() { return this._fixedBottomGap; }
102+
get fixedBottomGap(): number { return this._fixedBottomGap; }
103103
set fixedBottomGap(value) { this._fixedBottomGap = coerceNumberProperty(value); }
104104
private _fixedBottomGap = 0;
105105
}

src/lib/slider/slider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class MatSlider extends _MatSliderMixinBase
172172
/** The values at which the thumb will snap. */
173173
@Input()
174174
get step() { return this._step; }
175-
set step(v) {
175+
set step(v: number) {
176176
this._step = coerceNumberProperty(v, this._step);
177177

178178
if (this._step % 1 !== 0) {
@@ -201,7 +201,7 @@ export class MatSlider extends _MatSliderMixinBase
201201
*/
202202
@Input()
203203
get tickInterval() { return this._tickInterval; }
204-
set tickInterval(value) {
204+
set tickInterval(value: 'auto' | number) {
205205
if (value === 'auto') {
206206
this._tickInterval = 'auto';
207207
} else if (typeof value === 'number' || typeof value === 'string') {
@@ -267,7 +267,7 @@ export class MatSlider extends _MatSliderMixinBase
267267
onTouched: () => any = () => {};
268268

269269
/** The percentage of the slider that coincides with the value. */
270-
get percent() { return this._clamp(this._percent); }
270+
get percent(): number { return this._clamp(this._percent); }
271271
private _percent: number = 0;
272272

273273
/**

src/lib/snack-bar/snack-bar.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ export class MatSnackBar {
9999
* @param action The label for the snackbar action.
100100
* @param config Additional configuration options for the snackbar.
101101
*/
102-
open(message: string, action = '', config?: MatSnackBarConfig): MatSnackBarRef<SimpleSnackBar> {
102+
open(message: string, action: string = '', config?: MatSnackBarConfig):
103+
MatSnackBarRef<SimpleSnackBar> {
103104
const _config = _applyConfigDefaults(config);
104105

105106
// Since the user doesn't have access to the component, we can

0 commit comments

Comments
 (0)