Libraries specified in lib
in tsconfig.json should be emitted as reference directives in declarations
#27416
Closed
4 tasks done
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
Search Terms
lib declaration
lib tsconfig emitted
Suggestion
When specifying
"lib": ["es2017.sharedmemory"],
intsconfig.json
, I expected the output declaration files to include a reference directive to the lib, for example,/// <reference lib="es2017.sharedmemory"/>
. Not doing so means that if I publish a package to npm that uses theSharedArrayBuffer
type, the consumer will have to specify"lib": ["es2017.sharedmemory"],
in theirtsconfig.json
too. This is super leaky as the original package could be used many levels deep and the requirement leaks to the top. This makes it unfeasible to use any kind of extralib
in a reusable package.Relevant issue: sindresorhus/is#51
My current workaround is to manually add the reference directives (which is now possible in TS 3.1.1, thanks to #26497), but this doesn't scale if the package has many files.
Use Cases
Being able to use types for modern features without the consumer having to know what I'm using internally.
Examples
https://github.com/sindresorhus/is/blob/c983ffa4cd83c114b18d021c180e6ba9265070cd/source/index.ts#L181
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: