Typescript: "d" files for organizing project

Created on 14 May 2019  ·  6Comments  ·  Source: microsoft/TypeScript

Is it possible to use .d files for organizational purposes? For example to store type structures separated from realization:
data.ts file

class MyClass {
  constructor(public prop: IMyObject){
  } 
}

data.d.ts file

interface IMyObject {
  prop1: string
  prop2: number
}

Currently my .ts file doesn't recognize its corresponding .d.ts file

Question

All 6 comments

@akopchinskiy yes, you should have different file names. E.g. data.ts and data-types.ts.
Compiler ignores data.d.ts if you have data.ts because data.d.ts looks like generated from data.ts.

It looks like this is a question rather than a bug report. This issue tracker is for tracking bugs and active work on TypeScript itself, rather than a general forum for programmers using TypeScript to get help or ask questions.

You can ask questions on sites like Stack Overflow. We are not able to provide one-on-one support on the issue tracker. Please read the issue template carefully - it has important information on what kinds of reports can be acted on here, as well as links to useful TypeScript resources. Thanks!

@RyanCavanaugh Why then this repo allows to select "question" type of a topic?
And I don't like Stack Overflow. It has very toxic community.

I don't like Taco Bell but that doesn't mean McDonald's has to serve me tacos.

@RyanCavanaugh Actually, MD have taco in his menu.

@akopchinskiy FYI: I'm on Stack Overflow all the time, I try to keep it non-toxic. At least for the TS tag, the conversations are usually polite and productive 😊. Not all corners of SO are the same.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wmaurer picture wmaurer  ·  3Comments

manekinekko picture manekinekko  ·  3Comments

Antony-Jones picture Antony-Jones  ·  3Comments

fwanicka picture fwanicka  ·  3Comments

bgrieder picture bgrieder  ·  3Comments