Skip to content

v2.1.0

Choose a tag to compare

@vovkabelov vovkabelov released this 28 Oct 06:28
· 4 commits to main since this release

Сгенерированный .d.ts расширения добавляет в глобальную область только неймспейс расширения. В нём объявлено ровно то, что экспортирует точка входа, под именами экспорта, включая типы и интерфейсы: BX.Main.PopupOptions вместо глобального PopupOptions. Внутренние типы и классы, на которые ссылаются публичные сигнатуры, остаются приватными в файле: снаружи к ним не обратиться, и с одноимёнными типами других расширений они не конфликтуют. Типы npm-пакетов тоже приватны.

Исправлены крайние случаи генерации .d.ts. Тип, экспортированный под другим именем (Refusal as RefusalModel), объявляется только под ним, и ссылки ведут на него, а не на копию. Символ, экспортированный под несколькими именами (PopupManager и PopupWindowManager), объявляется один раз, а остальные имена ссылаются на него; раньше они пропадали. Ссылки на значения других расширений сохраняют typeof, а TypeScript-исходники расширения находятся, даже если алиас ведёт на JS-точку входа. Во встроенных типах npm-пакетов появились значения, на которые эти типы ссылаются, например typeof Fragment и typeof nextTick во Vue; раньше на их месте были ошибки.


The generated .d.ts of an extension adds only the extension namespace to the global scope. It declares exactly what the entry point exports, under the export names, including types and interfaces: BX.Main.PopupOptions instead of a global PopupOptions. Internal types and classes referenced by public signatures stay private to the file: they cannot be reached from outside and do not collide with same-named types of other extensions. npm package types are private as well.

Edge cases of .d.ts generation are fixed. A type exported under another name (Refusal as RefusalModel) is declared only under that name, and references point to it instead of a copy. A symbol exported under several names (PopupManager and PopupWindowManager) is declared once, and the other names refer to it; previously they were missing. References to values of other extensions keep typeof, and an extension's TypeScript sources are found even when its alias points at a JS entry. Inlined npm types now include the values they reference, such as typeof Fragment and typeof nextTick in Vue; previously these were errors.