Home > Net >  How to redefine type for an existing function in Typescript
How to redefine type for an existing function in Typescript

Time:09-09

Solution here https://www.albertgao.xyz/2016/08/11/how-to-declare-a-function-type-variable-in-typescript/ requires to define an expression, that's not what I want. What I want is to declare existing function as any something like this except syntax is not valid:

function f() {} as any;
f.someProperty = "I want to do this without squizzle in vscode";

goal is to avoid squizzle in VScode.

CodePudding user response:

Does this work for you?

const f = function () {} as any;
f.someProperty;
  • Related