declare function quick fix
Provide a quick fix for calls to unknown functions to declare a function of that name in current or module scope. Similar to the "declare method" quick fix for methods in classes.
Write code that consumes a function before writing it to let you figure out the order of arguments etc. Function parameter types and names should be inferred from arguments given at call site, just like "declare method".
declare x: boolean;
declare y: string;
foo(x, y, 123); // Cannot find name 'foo'
Cursor at squiggly -> Quick fix "Declare function in module scope" ->
declare x: boolean;
declare y: string;
foo(x, y, 123);
function foo(x: boolean, y: string, arg3: number) {
}
My suggestion meets these guidelines:
@RyanCavanaugh Should this feature be created as a new QF service or added to some of the existing ones?
@a-tarasyuk please don't implement features in the Awaiting More Feedback state - we can only take PRs for things assigned to the Backlog or a named release milestone
@RyanCavanaugh I think this issue related to https://github.com/microsoft/TypeScript/issues/26217 somehow, which is located in the Backlog milestone. However, don't worry I won't work on it. :hand::point_up:
@a-tarasyuk yes, I think that issue covers this.
Closing in favor of #26217