Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/services/codefixes/inferFromUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,9 @@ namespace ts.codefix {
}

interface ParameterInference {
declaration: ParameterDeclaration;
type?: Type;
typeNode?: TypeNode;
isOptional?: boolean;
readonly declaration: ParameterDeclaration;
readonly type?: Type;
readonly isOptional?: boolean;
}

namespace InferFromReference {
Expand Down Expand Up @@ -309,7 +308,7 @@ namespace ts.codefix {
}
const isConstructor = declaration.kind === SyntaxKind.Constructor;
const callContexts = isConstructor ? usageContext.constructContexts : usageContext.callContexts;
return callContexts && declaration.parameters.map((parameter, parameterIndex) => {
return callContexts && declaration.parameters.map((parameter, parameterIndex): ParameterInference => {
Copy link
Author

@ghost ghost Oct 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return types don't get a contextual type. (Is there an issue for that?) This made it look like isOptional was unused. Currently it's write-only but that should change in #27978.

const types: Type[] = [];
const isRest = isRestParameter(parameter);
let isOptional = false;
Expand Down