Skip to content

Commit b071d64

Browse files
amcdnljelbourn
authored andcommitted
chore(docs): add types to public and jsdoc cleanup (#7711)
1 parent 33afd93 commit b071d64

File tree

30 files changed

+159
-129
lines changed

30 files changed

+159
-129
lines changed

src/cdk/accordion/accordion-item.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ let nextId = 0;
3232
})
3333
export class CdkAccordionItem implements OnDestroy {
3434
/** Event emitted every time the AccordionItem is closed. */
35-
@Output() closed = new EventEmitter<void>();
35+
@Output() closed: EventEmitter<void> = new EventEmitter<void>();
3636
/** Event emitted every time the AccordionItem is opened. */
37-
@Output() opened = new EventEmitter<void>();
37+
@Output() opened: EventEmitter<void> = new EventEmitter<void>();
3838
/** Event emitted when the AccordionItem is destroyed. */
39-
@Output() destroyed = new EventEmitter<void>();
39+
@Output() destroyed: EventEmitter<void> = new EventEmitter<void>();
4040
/** The unique AccordionItem id. */
41-
readonly id = `cdk-accordion-child-${nextId++}`;
41+
readonly id: string = `cdk-accordion-child-${nextId++}`;
4242

4343
/** Whether the AccordionItem is expanded. */
4444
@Input()

src/cdk/stepper/stepper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,14 @@ export class CdkStepper implements OnDestroy {
171171

172172
/** The step that is selected. */
173173
@Input()
174-
get selected() { return this._steps.toArray()[this.selectedIndex]; }
174+
get selected(): CdkStep { return this._steps.toArray()[this.selectedIndex]; }
175175
set selected(step: CdkStep) {
176176
this.selectedIndex = this._steps.toArray().indexOf(step);
177177
}
178178

179179
/** Event emitted when the selected step has changed. */
180-
@Output() selectionChange = new EventEmitter<StepperSelectionEvent>();
180+
@Output() selectionChange: EventEmitter<StepperSelectionEvent>
181+
= new EventEmitter<StepperSelectionEvent>();
181182

182183
/** The index of the step that the focus can be set. */
183184
_focusIndex: number = 0;

src/cdk/table/table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export class CdkTable<T> implements CollectionViewer, OnInit, AfterContentChecke
171171
* Stream containing the latest information on what rows are being displayed on screen.
172172
* Can be used by the data source to as a heuristic of what data should be provided.
173173
*/
174-
viewChange =
174+
viewChange: BehaviorSubject<{start: number, end: number}> =
175175
new BehaviorSubject<{start: number, end: number}>({start: 0, end: Number.MAX_VALUE});
176176

177177
// Placeholders within the table's template where the header and data rows will be inserted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
115115
return this._vertical;
116116
}
117117

118-
set vertical(value) {
118+
set vertical(value: boolean) {
119119
this._vertical = coerceBooleanProperty(value);
120120
}
121121

@@ -141,7 +141,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
141141

142142
/** Whether the toggle group is selected. */
143143
@Input()
144-
get selected() {
144+
get selected(): MatButtonToggle | null {
145145
return this._selected;
146146
}
147147

src/lib/chips/chip-input.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class MatChipInput {
5353
* Whether or not the chipEnd event will be emitted when the input is blurred.
5454
*/
5555
@Input('matChipInputAddOnBlur')
56-
get addOnBlur() { return this._addOnBlur; }
56+
get addOnBlur(): boolean { return this._addOnBlur; }
5757
set addOnBlur(value: boolean) { this._addOnBlur = coerceBooleanProperty(value); }
5858
_addOnBlur: boolean = false;
5959

@@ -67,7 +67,7 @@ export class MatChipInput {
6767

6868
/** Emitted when a chip is to be added. */
6969
@Output('matChipInputTokenEnd')
70-
chipEnd = new EventEmitter<MatChipInputEvent>();
70+
chipEnd: EventEmitter<MatChipInputEvent> = new EventEmitter<MatChipInputEvent>();
7171

7272
/** The input's placeholder text. */
7373
@Input() placeholder: string = '';
@@ -127,5 +127,5 @@ export class MatChipInput {
127127
this._chipList.stateChanges.next();
128128
}
129129

130-
focus() { this._inputElement.focus(); }
130+
focus(): void { this._inputElement.focus(); }
131131
}

src/lib/chips/chip-list.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
227227
this._id = value;
228228
this.stateChanges.next();
229229
}
230-
get id() { return this._id || this._uid; }
230+
get id(): string { return this._id || this._uid; }
231231

232232
/** Required for FormFieldControl. Whether the chip list is required. */
233233
@Input()
234-
set required(value: any) {
234+
set required(value: boolean) {
235235
this._required = coerceBooleanProperty(value);
236236
this.stateChanges.next();
237237
}
238-
get required() {
238+
get required(): boolean {
239239
return this._required;
240240
}
241241

@@ -245,7 +245,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
245245
this._placeholder = value;
246246
this.stateChanges.next();
247247
}
248-
get placeholder() {
248+
get placeholder(): string {
249249
return this._chipInput ? this._chipInput.placeholder : this._placeholder;
250250
}
251251

@@ -260,6 +260,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
260260
return (!this._chipInput || this._chipInput.empty) && this.chips.length === 0;
261261
}
262262

263+
/** @docs-private */
263264
get shouldLabelFloat(): boolean {
264265
return !this.empty || this.focused;
265266
}
@@ -315,7 +316,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
315316
* to facilitate the two-way binding for the `value` input.
316317
* @docs-private
317318
*/
318-
@Output() valueChange = new EventEmitter<any>();
319+
@Output() valueChange: EventEmitter<any> = new EventEmitter<any>();
319320

320321
/** The chip components contained within this chip list. */
321322
@ContentChildren(MatChip) chips: QueryList<MatChip>;
@@ -389,7 +390,10 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
389390
this._chipInput = inputElement;
390391
}
391392

392-
// Implemented as part of MatFormFieldControl.
393+
/**
394+
* Implemented as part of MatFormFieldControl.
395+
* @docs-private
396+
*/
393397
setDescribedByIds(ids: string[]) { this._ariaDescribedby = ids.join(' '); }
394398

395399
// Implemented as part of ControlValueAccessor
@@ -416,6 +420,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
416420
this.stateChanges.next();
417421
}
418422

423+
/** @docs-private */
419424
onContainerClick() {
420425
this.focus();
421426
}
@@ -424,7 +429,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
424429
* Focuses the the first non-disabled chip in this chip list, or the associated input when there
425430
* are no eligible chips.
426431
*/
427-
focus() {
432+
focus(): void {
428433
// TODO: ARIA says this should focus the first `selected` chip if any are selected.
429434
// Focus on first element if there's no chipInput inside chip-list
430435
if (this._chipInput && this._chipInput.focused) {

src/lib/chips/chip.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
151151
_onBlur = new Subject<MatChipEvent>();
152152

153153
/** Emitted when the chip is selected or deselected. */
154-
@Output() selectionChange = new EventEmitter<MatChipSelectionChange>();
154+
@Output() selectionChange: EventEmitter<MatChipSelectionChange>
155+
= new EventEmitter<MatChipSelectionChange>();
155156

156157
/** Emitted when the chip is destroyed. */
157158
@Output() destroyed = new EventEmitter<MatChipEvent>();
@@ -160,16 +161,16 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
160161
* Emitted when the chip is destroyed.
161162
* @deprecated Use 'destroyed' instead.
162163
*/
163-
@Output() destroy = this.destroyed;
164+
@Output() destroy: EventEmitter<MatChipEvent> = this.destroyed;
164165

165166
/** Emitted when a chip is to be removed. */
166-
@Output() removed = new EventEmitter<MatChipEvent>();
167+
@Output() removed: EventEmitter<MatChipEvent> = new EventEmitter<MatChipEvent>();
167168

168169
/**
169170
* Emitted when a chip is to be removed.
170171
* @deprecated Use `removed` instead.
171172
*/
172-
@Output('remove') onRemove = this.removed;
173+
@Output('remove') onRemove: EventEmitter<MatChipEvent> = this.removed;
173174

174175
get ariaSelected(): string | null {
175176
return this.selectable ? this.selected.toString() : null;

src/lib/datepicker/datepicker-input.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
155155

156156
/** Whether the datepicker-input is disabled. */
157157
@Input()
158-
get disabled() { return !!this._disabled; }
159-
set disabled(value: any) {
158+
get disabled(): boolean { return !!this._disabled; }
159+
set disabled(value: boolean) {
160160
const newValue = coerceBooleanProperty(value);
161161

162162
if (this._disabled !== newValue) {
@@ -167,10 +167,12 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
167167
private _disabled: boolean;
168168

169169
/** Emits when a `change` event is fired on this `<input>`. */
170-
@Output() dateChange = new EventEmitter<MatDatepickerInputEvent<D>>();
170+
@Output() dateChange: EventEmitter<MatDatepickerInputEvent<D>>
171+
= new EventEmitter<MatDatepickerInputEvent<D>>();
171172

172173
/** Emits when an `input` event is fired on this `<input>`. */
173-
@Output() dateInput = new EventEmitter<MatDatepickerInputEvent<D>>();
174+
@Output() dateInput: EventEmitter<MatDatepickerInputEvent<D>>
175+
= new EventEmitter<MatDatepickerInputEvent<D>>();
174176

175177
/** Emits when the value changes (either due to user input or programmatic change). */
176178
_valueChange = new EventEmitter<D|null>();
@@ -263,6 +265,7 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
263265
this._disabledChange.complete();
264266
}
265267

268+
/** @docs-private */
266269
registerOnValidatorChange(fn: () => void): void {
267270
this._validatorOnChange = fn;
268271
}

src/lib/datepicker/datepicker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class MatDatepicker<D> implements OnDestroy {
163163
* Emits new selected date when selected date changes.
164164
* @deprecated Switch to the `dateChange` and `dateInput` binding on the input element.
165165
*/
166-
@Output() selectedChanged = new EventEmitter<D>();
166+
@Output() selectedChanged: EventEmitter<D> = new EventEmitter<D>();
167167

168168
/** Classes to be passed to the date picker panel. Supports the same syntax as `ngClass`. */
169169
@Input() panelClass: string | string[];
@@ -181,7 +181,7 @@ export class MatDatepicker<D> implements OnDestroy {
181181
private _opened = false;
182182

183183
/** The id for the datepicker calendar. */
184-
id = `mat-datepicker-${datepickerUid++}`;
184+
id: string = `mat-datepicker-${datepickerUid++}`;
185185

186186
/** The currently selected date. */
187187
get _selected(): D | null { return this._validSelected; }

src/lib/dialog/dialog-ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class MatDialogRef<T, R = any> {
3131
componentInstance: T;
3232

3333
/** Whether the user is allowed to close the dialog. */
34-
disableClose = this._containerInstance._config.disableClose;
34+
disableClose: boolean | undefined = this._containerInstance._config.disableClose;
3535

3636
/** Subject for notifying the user that the dialog has finished opening. */
3737
private _afterOpen = new Subject<void>();

0 commit comments

Comments
 (0)