mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
//// [tests/cases/conformance/nonjsExtensions/declarationFileForHtmlFileWithinDeclarationFile.ts] ////
|
|
|
|
//// [component.d.html.ts]
|
|
// html modules were proposed at https://github.com/WICG/webcomponents/blob/gh-pages/proposals/html-modules-explainer.md
|
|
|
|
// per proposal, `default` is user-defined, but if not present, will be the document of the imported module
|
|
declare var doc: Document;
|
|
export default doc;
|
|
|
|
// all other exports are just whatever was exported in module script blocks in the html file
|
|
export const blogPost: Element;
|
|
|
|
export class HTML5Element extends HTMLElement {
|
|
connectedCallback(): void;
|
|
}
|
|
|
|
//// [file.d.ts]
|
|
export * as mod from "./component.html";
|
|
|
|
//// [main.ts]
|
|
import { mod } from "./file.js";
|
|
|
|
window.customElements.define("my-html5-element", mod.HTML5Element);
|
|
|
|
if (document !== mod.default) {
|
|
document.body.appendChild(mod.blogPost);
|
|
}
|
|
|
|
//// [main.js]
|
|
import { mod } from "./file.js";
|
|
window.customElements.define("my-html5-element", mod.HTML5Element);
|
|
if (document !== mod.default) {
|
|
document.body.appendChild(mod.blogPost);
|
|
}
|