VS Code automatically infers your TypeScript types in a project, even if you haven't implicitly declared it yourself. However, if it is long it will hide some parts of it. This is how you get the full type.
When you try to copy the type directly from the inferred VS Code type, you get this shortened version which do not include all the details.
The solution is quite simple and will use
First of all, be sure that you do not have any types defined in the file from the beginning. Then run the following script.
tsc filename.ts --declaration --emitDeclarationOnly
This will create a file with the full definition. Simple as that.
If you haven’t installed
tsc you can choose to either use
npx or install it globally.
# install if before running the command npm install typescript -g # or run it with npx npx tsc filename.ts --declaration --emitDeclarationOnly