Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added helpful error when missing type parameters #1182

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7941,6 +7941,16 @@ export class Compiler extends DiagnosticEmitter {
}
case ElementKind.FUNCTION_PROTOTYPE: {
let functionPrototype = <FunctionPrototype>target;
let typeParameterNodes = functionPrototype.typeParameterNodes;

if(typeParameterNodes !== null && typeParameterNodes.length != 0) {
DuncanUszkay1 marked this conversation as resolved.
Show resolved Hide resolved
this.error(
DiagnosticCode.Expected_0_arguments_but_got_1,
expression.range, typeParameterNodes.length.toString(), "0"
);
return module.unreachable();
}

let functionInstance = this.resolver.resolveFunction(
functionPrototype,
null,
Expand Down