Skip to content

Intersection of features in modular lib files #11093

Closed
@T-Hugs

Description

@T-Hugs

TypeScript Version: 2.0.3

It is very unclear how to effectively use the --lib compiler option. It appears there is a default set of libs that are included (i.e. when no --lib is specified). If any libs are specified with --lib, then it seems this default set gets replaced with the set you provide. I haven't been able to find any documentation on exactly what is in the default set.

Here's the issue I'm running into. I want to use the [default set] + es2015.collection. I've tried a number of things.

  • --lib es2015.collection OR --lib es6 - Lots of errors because DOM isn't declared
  • --lib es6,dom,scripthost,webworker - Several errors about duplicate signatures and declarations, e.g.
    lib.dom.d.ts(2145,5): error TS2375: Build: Duplicate number index signature.
    lib.dom.d.ts(3772,14): error TS2403: Build: Subsequent variable declarations must have the same type. Variable 'srcElement' must be of type 'any', but here has type 'Element'.
  • [no --lib option] - Can't use ES6 sets/maps.

Expected behavior:
Either the set of libs you can import needs to be disjoint, or the compiler should be able to handle duplicate declarations in these files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsThe issue relates to how you learn TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions