|
1 | | -// Using the same "brand" as the types for `htmlbars-inline-precompile` for |
2 | | -// backwards compatibility. The actual value of the brand doesn't matter; it is |
3 | | -// only important that it (a) is distinct and (b) interoperates with existing |
4 | | -// uses of the `hbs` export from `htmlbars-inline-precompile` [1]. |
5 | | -// |
6 | | -// [1]: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/24a21e0b8ec7eccdec781d7513bfa5947f1c6e20/types/ember/index.d.ts#L540:L542 |
7 | | -// |
8 | | -// Note that we *intentionally* do not export this; the details are irrelevant |
9 | | -// to consumers. The point is simply to have a *distinct* type that is therefore |
10 | | -// not substitutable for just any other type. |
11 | | -interface TemplateFactory { |
12 | | - __htmlbars_inline_precompile_template_factory: any; |
| 1 | +// Shut off automatically-export-everything-mode. We only want to export the |
| 2 | +// things we explicitly *say* to export. |
| 3 | +export {}; |
| 4 | + |
| 5 | +// Allows us to create a branded/opaque type which can *only* be constructed |
| 6 | +// without an unsafe cast by calling `hbs()`. |
| 7 | +declare const Data: unique symbol; |
| 8 | + |
| 9 | +/** |
| 10 | + The result of calling `hbs()`: an internal type for Ember to use with other |
| 11 | + framework-level APIs (public and private) like `setComponentTemplate()`. |
| 12 | +
|
| 13 | + This type is *not* user-constructible; it is only legal to get it from `hbs`. |
| 14 | + */ |
| 15 | +declare class TemplateFactory { |
| 16 | + private [Data]: 'template-factory'; |
13 | 17 | } |
14 | 18 |
|
| 19 | +// Only export the type side of the class, so that callers are not misled into |
| 20 | +// thinking that they can instantiate, subclass, etc. |
| 21 | +export type { TemplateFactory }; |
| 22 | + |
15 | 23 | export interface PrecompileOptions { |
16 | 24 | moduleName?: string; |
17 | 25 | parseOptions?: { |
|
0 commit comments