Skip to content

containerSeemsToBeEmptyDomElement does not check correctly for lib.dom.d.tsΒ #61466

Closed
@frodi-karlsson

Description

@frodi-karlsson

πŸ”Ž Search Terms

"compiler option to include", "containerSeemsToBeEmptyDomElement"

πŸ•— Version & Regression Information

  • This changed in commit 31374d2 when this diagnostic was added

⏯ Playground Link

https://github.com/frodi-karlsson/lib-dom-example

πŸ’» Code

// tsconfig.json
{
  "compilerOptions": {
    "target": "esnext",
    "lib": ["es5", "dom"],
    "noEmit": true
  },
  "files": ["index.ts"]
}
// index.ts
interface HTMLXYZElement {}

const a = {} as HTMLXYZElement;

// gives us Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom
// when it should give Property_0_does_not_exist_on_type_1
a.innerText = "hello";

πŸ™ Actual behavior

Property 'innerText' does not exist on type 'HTMLXYZElement'. Try changing the 'lib' compiler option to include 'dom'.

πŸ™‚ Expected behavior

Property 'innerText' does not exist on type 'HTMLXYZElement'.

Additional information about the issue

Bit of a duplicate of #54484 which did not have sufficient adherence to issue template. Noticed by @jakebailey here

There's a check for "dom" that should be "lib.dom.d.ts"

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions