I want to know what is the right way to use types or interfaces without directly importing them (if that's an ok idea).
Currently I have this code:
import { TCollection } from "../__types__"; function doSomething(collection: TCollection) { // ... } So to get rid of an import statement I have tried to replace typeRoots inside of tsconfig.json with this value:
{ "compilerOptions": { ... "typeRoots": ["./src/__types__/types.d.ts", "./node_modules/@types"], } } And declared a type in ./src/__types__/types.d.ts:
declare type TCollection = { ... }; But still having an error:
function doSomething(collection: TCollection) { ^^^^^^^^^^^ Cannot find name 'TCollection'.ts(2304) } Did I made a mistake or is it an IDE bug or something? Thanks