F
F
Fedooot012021-07-19 13:20:20
phpstorm
Fedooot01, 2021-07-19 13:20:20

How to declare to use d.ts files in PHPStorm?

Hello, I'm trying to write TypeScript in PHPStorm. If you declare the types of variables, functions, etc. in place, right in the code, then in general everything is fine.

But sometimes you want to do this not in code, but in separate files that were invented for this - d.ts. I have questions:

  1. how to make PHPStorm pick up d.ts files automatically?
  2. where to store these d.ts files?
  3. how to make PHPStorm understand from which file to apply the type description for the current file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2021-07-19
@Fedooot01

how to make PHPStorm pick up d.ts files automatically?

Your d.ts file must be included in tsconfig.json
where to store these d.ts files?

Where is it convenient for you
how to make PHPStorm understand from which file to apply the type description for the current file

There are two options.
Your types are registered globally. Specify from which file is not needed.
The types are not global or there is a naming conflict. Normalimport type { ... } from ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question