Typescript generates declaration d.ts file with `#private;` field

前端 未结 3 1810
心在旅途
心在旅途 2021-01-12 13:08

I have a library, written in Typescript, that is being distributed in 2 files: a compiled ECMAScript-2015 compatible Javascript file index.js and a Typescript d

3条回答
  •  迷失自我
    2021-01-12 13:33

    I tried to answer your question but was unable to, then I asked my own question out of curiosity, which was answered by a TypeScript contributor, you can find his answer here: What's the purpose of #private in TypeScript definition files?

    To summarize, there are some cases where private fields matter when it comes to the comparison between to types, that's why the #private field appears so that the information "contains private members" is part of the type definition.

提交回复
热议问题