Skip to content

Commit

Permalink
build: more type information for docs (#6947)
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion authored and kara committed Oct 4, 2017
1 parent a774688 commit 388845c
Show file tree
Hide file tree
Showing 41 changed files with 3,282 additions and 993 deletions.
3,099 changes: 2,604 additions & 495 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 @@ -60,8 +60,8 @@
"axe-core": "^2.3.1",
"axe-webdriverjs": "^1.1.1",
"chalk": "^1.1.3",
"dgeni": "^0.4.7",
"dgeni-packages": "^0.19.1",
"dgeni": "^0.4.9",
"dgeni-packages": "^0.21.1",
"firebase": "^4.0.0",
"firebase-admin": "^5.0.0",
"firebase-tools": "^3.11.0",
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/a11y/focus-trap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export class FocusTrapFactory {
private _platform: Platform,
private _ngZone: NgZone) { }

create(element: HTMLElement, deferAnchors = false): FocusTrap {
create(element: HTMLElement, deferAnchors: boolean = false): FocusTrap {
return new FocusTrap(element, this._platform, this._checker, this._ngZone, deferAnchors);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/a11y/list-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {
* Turns on typeahead mode which allows users to set the active item by typing.
* @param debounceInterval Time to wait after the last keystroke before setting the active item.
*/
withTypeAhead(debounceInterval = 200): this {
withTypeAhead(debounceInterval: number = 200): this {
if (this._items.length && this._items.some(item => typeof item.getLabel !== 'function')) {
throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/observers/observe-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {RxChain, debounceTime} from '@angular/cdk/rxjs';
*/
@Injectable()
export class MatMutationObserverFactory {
create(callback): MutationObserver | null {
create(callback: MutationCallback): MutationObserver | null {
return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/overlay/position/connected-position-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ConnectedPositionStrategy implements PositionStrategy {
}

/** Ordered list of preferred positions, from most to least desirable. */
get positions() {
get positions(): ConnectionPositionPair[] {
return this._preferredPositions;
}

Expand Down
16 changes: 8 additions & 8 deletions src/cdk/overlay/position/global-position-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
* Sets the top position of the overlay. Clears any previously set vertical position.
* @param value New top offset.
*/
top(value = ''): this {
top(value: string = ''): this {
this._bottomOffset = '';
this._topOffset = value;
this._alignItems = 'flex-start';
Expand All @@ -52,7 +52,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
* Sets the left position of the overlay. Clears any previously set horizontal position.
* @param value New left offset.
*/
left(value = ''): this {
left(value: string = ''): this {
this._rightOffset = '';
this._leftOffset = value;
this._justifyContent = 'flex-start';
Expand All @@ -63,7 +63,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
* Sets the bottom position of the overlay. Clears any previously set vertical position.
* @param value New bottom offset.
*/
bottom(value = ''): this {
bottom(value: string = ''): this {
this._topOffset = '';
this._bottomOffset = value;
this._alignItems = 'flex-end';
Expand All @@ -74,7 +74,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
* Sets the right position of the overlay. Clears any previously set horizontal position.
* @param value New right offset.
*/
right(value = ''): this {
right(value: string = ''): this {
this._leftOffset = '';
this._rightOffset = value;
this._justifyContent = 'flex-end';
Expand All @@ -85,7 +85,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
* Sets the overlay width and clears any previously set width.
* @param value New width for the overlay
*/
width(value = ''): this {
width(value: string = ''): this {
this._width = value;

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

// When the height is 100%, we should reset the `top` and the offset,
Expand All @@ -119,7 +119,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
*
* @param offset Overlay offset from the horizontal center.
*/
centerHorizontally(offset = ''): this {
centerHorizontally(offset: string = ''): this {
this.left(offset);
this._justifyContent = 'center';
return this;
Expand All @@ -131,7 +131,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
*
* @param offset Overlay offset from the vertical center.
*/
centerVertically(offset = ''): this {
centerVertically(offset: string = ''): this {
this.top(offset);
this._alignItems = 'center';
return this;
Expand Down
4 changes: 2 additions & 2 deletions src/cdk/scrolling/viewport-ruler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ViewportRuler {
}

/** Gets a ClientRect for the viewport's bounds. */
getViewportRect(documentRect = this._documentRect): ClientRect {
getViewportRect(documentRect: ClientRect | undefined = this._documentRect): ClientRect {
// Cache the document bounding rect so that we don't recompute it for multiple calls.
if (!documentRect) {
this._cacheViewportGeometry();
Expand Down Expand Up @@ -61,7 +61,7 @@ export class ViewportRuler {
* Gets the (top, left) scroll position of the viewport.
* @param documentRect
*/
getViewportScrollPosition(documentRect = this._documentRect) {
getViewportScrollPosition(documentRect: ClientRect | undefined = this._documentRect) {
// Cache the document bounding rect so that we don't recompute it for multiple calls.
if (!documentRect) {
this._cacheViewportGeometry();
Expand Down
6 changes: 3 additions & 3 deletions src/lib/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
_controlValueAccessorChangeFn: (value: any) => void = () => {};

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

/** Child button toggle buttons. */
@ContentChildren(forwardRef(() => MatButtonToggle)) _buttonToggles: QueryList<MatButtonToggle>;
Expand Down Expand Up @@ -215,7 +215,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
* @param fn On touch callback function.
*/
registerOnTouched(fn: any) {
this.onTouched = fn;
this._onTouched = fn;
}

/**
Expand Down Expand Up @@ -436,7 +436,7 @@ export class MatButtonToggle implements OnInit, OnDestroy {
let groupValueChanged = this.buttonToggleGroup.selected != this;
this.checked = true;
this.buttonToggleGroup.selected = this;
this.buttonToggleGroup.onTouched();
this.buttonToggleGroup._onTouched();
if (groupValueChanged) {
this.buttonToggleGroup._emitChangeEvent();
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/chips/chip-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class MatChipInput {
*/
@Input('matChipInputAddOnBlur')
get addOnBlur() { return this._addOnBlur; }
set addOnBlur(value) { this._addOnBlur = coerceBooleanProperty(value); }
set addOnBlur(value: boolean) { this._addOnBlur = coerceBooleanProperty(value); }
_addOnBlur: boolean = false;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/chips/chip-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class MatChipList implements MatFormFieldControl<any>, ControlValueAccess
}

/** Whether any chips or the matChipInput inside of this chip-list has focus. */
get focused() {
get focused(): boolean {
return this.chips.some(chip => chip._hasFocus) ||
(this._chipInput && this._chipInput.focused);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/option/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class MatOption {
}

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

/** Whether or not the option is currently selected. */
get selected(): boolean { return this._selected; }
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/ripple/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class MatRipple implements OnChanges, OnDestroy {
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/lib/datepicker/datepicker-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class MatDatepickerToggle<D> implements OnChanges, OnDestroy {

/** Whether the toggle button is disabled. */
@Input()
get disabled() {
get disabled(): boolean {
return this._disabled === undefined ? this.datepicker.disabled : this._disabled;
}
set disabled(value) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dialog/dialog-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class MatDialogRef<T> {
* @param width New width of the dialog.
* @param height New height of the dialog.
*/
updateSize(width = 'auto', height = 'auto'): this {
updateSize(width: string = 'auto', height: string = 'auto'): this {
this._getPositionStrategy().width(width).height(height);
this._overlayRef.updatePosition();
return this;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/form-field/form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class MatFormField implements AfterViewInit, AfterContentInit, AfterConte

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

/** Whether the required marker should be hidden. */
Expand Down
4 changes: 2 additions & 2 deletions src/lib/grid-list/grid-tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export class MatGridTile {

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

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

/**
Expand Down
4 changes: 2 additions & 2 deletions src/lib/icon/icon-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class MatIconRegistry {
* @param alias Alias for the font.
* @param className Class name override to be used instead of the alias.
*/
registerFontClassAlias(alias: string, className = alias): this {
registerFontClassAlias(alias: string, className: string = alias): this {
this._fontCssClassesByAlias.set(alias, className);
return this;
}
Expand Down Expand Up @@ -215,7 +215,7 @@ export class MatIconRegistry {
* @param name Name of the icon to be retrieved.
* @param namespace Namespace in which to look for the icon.
*/
getNamedSvgIcon(name: string, namespace = ''): Observable<SVGElement> {
getNamedSvgIcon(name: string, namespace: string = ''): Observable<SVGElement> {
// Return (copy of) cached icon if possible.
const key = iconKey(namespace, name);
const config = this._svgIconConfigs.get(key);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/menu/menu-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class MatMenu implements AfterContentInit, MatMenuPanel, OnDestroy {
* It's necessary to set position-based classes to ensure the menu panel animation
* folds out from the correct direction.
*/
setPositionClasses(posX = this.xPosition, posY = this.yPosition): void {
setPositionClasses(posX: MenuPositionX = this.xPosition, posY: MenuPositionY = this.yPosition) {
this._classList['mat-menu-before'] = posX === 'before';
this._classList['mat-menu-after'] = posX === 'after';
this._classList['mat-menu-above'] = posY === 'above';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class MatRadioGroup extends _MatRadioGroupMixinBase

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

Expand Down
2 changes: 1 addition & 1 deletion src/lib/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,5 +1205,5 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
}

// Implemented as part of MatFormFieldControl.
get shouldPlaceholderFloat() { return this._panelOpen || !this.empty; }
get shouldPlaceholderFloat(): boolean { return this._panelOpen || !this.empty; }
}
12 changes: 6 additions & 6 deletions src/lib/sidenav/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {

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

/** @deprecated */
@Input()
get align() { return this.position; }
get align(): 'start' | 'end' { return this.position; }
set align(value) { this.position = value; }

/** Mode of the drawer; one of 'over', 'push' or 'side'. */
@Input()
get mode() { return this._mode; }
get mode(): 'over' | 'push' | 'side' { return this._mode; }
set mode(value) {
this._mode = value;
this._modeChanged.next();
Expand Down Expand Up @@ -206,7 +206,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
*/
_modeChanged = new Subject();

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

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

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

/** Event emitted when the drawer backdrop is clicked. */
@Output() backdropClick = new EventEmitter<void>();
Expand Down
6 changes: 3 additions & 3 deletions src/lib/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class MatSidenavContent extends MatDrawerContent {
export class MatSidenav extends MatDrawer {
/** Whether the sidenav is fixed in the viewport. */
@Input()
get fixedInViewport() { return this._fixedInViewport; }
get fixedInViewport(): boolean { return this._fixedInViewport; }
set fixedInViewport(value) { this._fixedInViewport = coerceBooleanProperty(value); }
private _fixedInViewport = false;

Expand All @@ -90,7 +90,7 @@ export class MatSidenav extends MatDrawer {
* mode.
*/
@Input()
get fixedTopGap() { return this._fixedTopGap; }
get fixedTopGap(): number { return this._fixedTopGap; }
set fixedTopGap(value) { this._fixedTopGap = coerceNumberProperty(value); }
private _fixedTopGap = 0;

Expand All @@ -99,7 +99,7 @@ export class MatSidenav extends MatDrawer {
* fixed mode.
*/
@Input()
get fixedBottomGap() { return this._fixedBottomGap; }
get fixedBottomGap(): number { return this._fixedBottomGap; }
set fixedBottomGap(value) { this._fixedBottomGap = coerceNumberProperty(value); }
private _fixedBottomGap = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class MatSlider extends _MatSliderMixinBase
/** The values at which the thumb will snap. */
@Input()
get step() { return this._step; }
set step(v) {
set step(v: number) {
this._step = coerceNumberProperty(v, this._step);

if (this._step % 1 !== 0) {
Expand Down Expand Up @@ -201,7 +201,7 @@ export class MatSlider extends _MatSliderMixinBase
*/
@Input()
get tickInterval() { return this._tickInterval; }
set tickInterval(value) {
set tickInterval(value: 'auto' | number) {
if (value === 'auto') {
this._tickInterval = 'auto';
} else if (typeof value === 'number' || typeof value === 'string') {
Expand Down Expand Up @@ -267,7 +267,7 @@ export class MatSlider extends _MatSliderMixinBase
onTouched: () => any = () => {};

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

/**
Expand Down
3 changes: 2 additions & 1 deletion src/lib/snack-bar/snack-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ export class MatSnackBar {
* @param action The label for the snackbar action.
* @param config Additional configuration options for the snackbar.
*/
open(message: string, action = '', config?: MatSnackBarConfig): MatSnackBarRef<SimpleSnackBar> {
open(message: string, action: string = '', config?: MatSnackBarConfig):
MatSnackBarRef<SimpleSnackBar> {
const _config = _applyConfigDefaults(config);

// Since the user doesn't have access to the component, we can
Expand Down
Loading

0 comments on commit 388845c

Please sign in to comment.