TypeScript type guidelines

I read dozens of pages trying to figure out how best to set up type definitions in TypeScript.

  • I used to have a file typings.tssomewhere in my project and then import the types into every file they need, doing something like

import {IMyCustomType} from './typings';

and inside my sample file I would declare my types:

export interface IMyCustomType {...}

Instead of using, export interface IMyCustomType {..}they usedeclare interface IMyCustomType {..}

This installation has one big advantage for me: I don’t need to explicitly import types in each file, and interfaces are available directly in the whole project.

Questions:

1) , **/*.d.ts ?

2) declare ?

3) , ?

, . , , ?

+4

Source: https://habr.com/ru/post/1689040/


All Articles