ember-fastboot / simple-dom

208 stars 33 forks source link

ensure strict subset of lib.dom.d.ts #48

Closed krisselden closed 6 years ago

krisselden commented 6 years ago

ensure it is structurally compatible with the interfaces in lib.dom.d.ts

tomdale commented 6 years ago

Nice work. Thank you @krisselden.

chadhietala commented 6 years ago

Still seeing the following after updating:

node_modules/@glimmer/node/dist/types/lib/node-dom-helper.d.ts(4,22): error TS2415: Class 'NodeDOMTreeConstruction' incorrectly extends base class 'TreeConstruction'.
  Types of property 'document' are incompatible.
    Type 'Document' is not assignable to type 'Document'. Two different types with this name exist, but they are unrelated.
      Types of property 'createElement' are incompatible.
        Type '(tagName: string) => Element' is not assignable to type '(tag: string) => Element'.
          Type 'Element' is not assignable to type 'Element'. Two different types with this name exist, but they are unrelated.
            Property 'namespaceURI' is missing in type 'Element'.
packages/@glimmer/application/test/browser/application-test.ts(35,25): error TS2345: Argument of type '{ rootName: string; resolver: BlankResolver; document: Document; loader: RuntimeCompilerLoader; r...' is not assignable to parameter of type 'ApplicationOptions'.
  Types of property 'document' are incompatible.
    Type 'Document' is not assignable to type 'Document'. Two different types with this name exist, but they are unrelated.
packages/@glimmer/application/test/browser/environment-test.ts(194,28): error TS2345: Argument of type '{ document: Document; }' is not assignable to parameter of type 'AppBuilderOptions<TestApplication>'.
  Types of property 'document' are incompatible.
    Type 'Document' is not assignable to type 'Document'. Two different types with this name exist, but they are unrelated.
packages/@glimmer/application/test/initializers-test.ts(21,29): error TS2345: Argument of type '{ element: Element; nextSibling: null; }' is not assignable to parameter of type 'Cursor'.
  Types of property 'element' are incompatible.
    Type 'Element' is not assignable to type 'Element'. Two different types with this name exist, but they are unrelated.
krisselden commented 6 years ago

I think the issue is not between simple-dom and the lib.dom.d.ts but the Simple.Element inside @glimmer/interfaces, namespace doesn't make sense for serialization and doesn't belong in simple-dom interface, at best it should be made optional in Simple.Element.