Skip to content

Commit 7de4529

Browse files
devversionandrewseguin
authored andcommitted
chore: missing type for parameter in autosize (angular#8906)
* The ``MatTextareaAutosize` directive misses a type for the `resizeToFitContent` method. The `gulp api-docs` task showed that the type is missing. * Improves the `normalizeMethodParameters` method in the Dgeni setup, to also add type information to parameters that have been parsed properly by Dgeni, but still miss a type.
1 parent a4fb212 commit 7de4529

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/lib/input/autosize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class MatTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
170170
* @param force Whether to force a height recalculation. By default the height will be
171171
* recalculated only if the value changed since the last call.
172172
*/
173-
resizeToFitContent(force = false) {
173+
resizeToFitContent(force: boolean = false) {
174174
this._cacheTextareaLineHeight();
175175

176176
// If we haven't determined the line-height yet, we know we're still hidden and there's no point

tools/dgeni/common/normalize-method-parameters.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,23 @@ export function normalizeMethodParameters(method: NormalizedMethodMemberDoc) {
3737
method.params = [];
3838
}
3939

40-
const hasExistingParameterInfo = method.params.some(p => p.name == parameterName);
40+
if (!parameterType) {
41+
console.warn(`Missing parameter type information (${parameterName}) in ` +
42+
`${method.fileInfo.relativePath}:${method.startingLine}`);
43+
return;
44+
}
4145

42-
if (!hasExistingParameterInfo) {
43-
if (!parameterType) {
44-
console.warn(`Missing parameter type information (${parameterName}) in ` +
45-
`${method.fileInfo.relativePath}:${method.startingLine}`);
46-
return;
47-
}
46+
const existingParameterInfo = method.params.find(p => p.name == parameterName);
4847

49-
const newParameterInfo = {
48+
if (!existingParameterInfo) {
49+
method.params.push({
5050
name: parameterName,
5151
type: parameterType.trim(),
5252
isOptional: isOptional
53-
};
54-
55-
method.params.push(newParameterInfo);
53+
});
54+
} else {
55+
existingParameterInfo.type = parameterType.trim();
56+
existingParameterInfo.isOptional = isOptional;
5657
}
5758
});
5859
}

0 commit comments

Comments
 (0)