-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript: can't find built-in utility types if "noLib": true #106
Comments
I also encountered this problem, |
{
"compilerOptions": {
"lib": [
"ES5",
"ES2015",
"ES2016",
"ES2017",
"ES2018",
"ES2019",
"ES2020",
"ES2021",
"ESNext"
]
}
} |
I guess the reason is the 'noLib:true' setting in the tsconfig.json file of the declaration file. This setting can exclude the default dependency of lib.dom, because Document is overridden in the .d.ts file. By excluding lib.dom, there won't be any errors when writing declarations. However, after setting this, 'noLib:true' must also be set in the tsconfig.json of your own project, or you need to manually exclude lib.dom. This is my own understanding. If there is an official response, please let me know if I am right or wrong, or suggest a better way to set it up. Thank you. |
The issue with adding those to the
|
you can safely add the following from
|
@mindlid Yes sure! Or only copy the ones you need in your project (like |
Hi,
Thanks for making those type definitions, this is really helpful to be able to use TypeScript for Adobe products!
This is a sample config for
tsconfig.json
andpackage.json
:I found that this minimal example compiles but raise a TypeScript error during compilation:
I don't know the internals of how the
for ... in
gets compiled using generics but it made me realize that I can't use any of the utility types when using"noLib": true
intsconfig.json
:This is because utility types are located in
lib.es5.d.ts
therefore not included withnoLib
.I can still copy the
Extract
type definition in my project but maybe we can include them in the repository?Thanks!
The text was updated successfully, but these errors were encountered: