Skip to content

Commit ca2e07a

Browse files
committed
Make type declaration more accurate
1 parent caa76bf commit ca2e07a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apps/api-extractor/src/generators/ApiModelGenerator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,11 +826,11 @@ export class ApiModelGenerator {
826826
const propertyTypeTokenRange: IExcerptTokenRange = ExcerptBuilder.createEmptyTokenRange();
827827

828828
// If the property declaration's type is `undefined`, then we're processing a setter with no corresponding
829-
// getter. Use the parameter type instead (note that TSC will enforce that the setter has exactly one
830-
// parameter).
831-
const propertyTypeNode: ts.TypeNode =
829+
// getter. Use the parameter type instead (note that TypeScript always reports an error if a setter
830+
// does not have exactly one parameter).
831+
const propertyTypeNode: ts.TypeNode | undefined =
832832
(astDeclaration.declaration as ts.PropertyDeclaration | ts.GetAccessorDeclaration).type ||
833-
(astDeclaration.declaration as ts.SetAccessorDeclaration).parameters[0].type!;
833+
(astDeclaration.declaration as ts.SetAccessorDeclaration).parameters[0].type;
834834
nodesToCapture.push({ node: propertyTypeNode, tokenRange: propertyTypeTokenRange });
835835

836836
const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture);

0 commit comments

Comments
 (0)