You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a result, I can't build a project that imports @itwin/core-common and has this in the tsconfig:
"lib": ["ES2022"],
"skipLibCheck": false,
The ResponseLike class has properties with types such as ResponseType, which are only available if "DOM" is included in the lib option in tsconfig. As per Typescript documentation, that option should be excluded in projects that don't run in a web browser. If skipLibCheck is enabled, the exported type simply won't be resolved correctly.
Since @itwin/core-common is supposed to be included both in web browsers and in Node.js apps, we should probably have some sort of eslint rule or config to avoid re-exporting those types. We could add "lib": ["ES2021"] to its tsconfig, but that would result in a lot of errors (30 errors in 6 files) and in most cases they're not part of the API so it's not as necessary to change anything. As a more viable solution, we could redefine some of these types locally instead of using the globally defined ones. In the long term, removing DOM types could still be beneficial as we could redefine global variables to be optional (| undefined) to have better type checking.
The text was updated successfully, but these errors were encountered:
As a result, I can't build a project that imports
@itwin/core-common
and has this in the tsconfig:The
ResponseLike
class has properties with types such asResponseType
, which are only available if"DOM"
is included in thelib
option in tsconfig. As per Typescript documentation, that option should be excluded in projects that don't run in a web browser. IfskipLibCheck
is enabled, the exported type simply won't be resolved correctly.Since
@itwin/core-common
is supposed to be included both in web browsers and in Node.js apps, we should probably have some sort of eslint rule or config to avoid re-exporting those types. We could add"lib": ["ES2021"]
to its tsconfig, but that would result in a lot of errors (30 errors in 6 files) and in most cases they're not part of the API so it's not as necessary to change anything. As a more viable solution, we could redefine some of these types locally instead of using the globally defined ones. In the long term, removing DOM types could still be beneficial as we could redefine global variables to be optional (| undefined
) to have better type checking.The text was updated successfully, but these errors were encountered: