Skip to content

[Bug] Compilation Errors: ES2015 Built‑ins Required by nevware21 Type Definitions #557

@nev21

Description

@nev21

Here’s a completely plain, copy‑ready issue body with no nested code fences or formatting tricks:


Summary

This package fails to compile when consuming @nevware21/* libraries unless its tsconfig.json includes ES2015 type definitions. This happens even though nevware21 libraries target ES5 at runtime and provide internal polyfills.

The issue is caused by ES2015 built‑ins appearing in the TypeScript declaration files (.d.ts) of the nevware21 packages. TypeScript requires the corresponding type libraries to be included via "lib": ["ES2015"], otherwise it reports missing type errors.

This is a type‑level compatibility issue, not a runtime requirement.

Symptoms

Typical TypeScript errors include:

  • Cannot find name 'Promise'.
  • Cannot find name 'Map'.
  • Cannot find name 'Set'.
  • Cannot find name 'Symbol'.
  • Cannot find name 'IterableIterator'.
  • Property 'Symbol' does not exist on type ...

These errors appear when the package's tsconfig.json uses only ES5 libs, for example:

"compilerOptions": {
"lib": ["ES5", "DOM"]
}

or omits the lib field entirely (which effectively defaults to ES5).

Root Cause

The public .d.ts files in nevware21 libraries reference ES2015 built‑ins such as:

  • Promise
  • Map
  • Set
  • Symbol
  • Iterable / Iterator / IterableIterator
  • WeakMap / WeakSet

Even though the libraries themselves target ES5 and include internal polyfills for environments that lack these features at runtime, TypeScript still requires the ES2015 type definitions to be present in the consumer's tsconfig.json whenever these built‑ins appear in the type surface.

Required Fix (for this package)

Update this package's tsconfig.json to include ES2015 type libraries so that the TypeScript compiler has the necessary built‑in type definitions.

For browser or mixed environments:

{
"compilerOptions": {
"lib": ["ES2015", "DOM"]
}
}

For Node‑only environments:

{
"compilerOptions": {
"lib": ["ES2015"]
}
}

This resolves the missing type errors and aligns the package with the type surface exposed by the nevware21 libraries.

Notes

  • This does not change the JavaScript runtime target (it can remain ES5).
  • No ES2015 native features are required at runtime because nevware21 libraries provide their own polyfills/shims.
  • The change only affects which built‑in type definitions TypeScript loads during compilation.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions