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
I see the following error on the imports: Cannot find module '@databricks/sql/dist/contracts/IDBSQLSession' or its corresponding type declarations.ts(2307) Cannot find module '@databricks/sql/dist/contracts/IOperation' or its corresponding type declarations.ts(2307)
I worked around this by changing the imports to be like so:
import type IDBSQLSession from "@databricks/sql/dist/contracts/IDBSQLSession.d.ts";
import type IOperation from "@databricks/sql/dist/contracts/IOperation.d.ts";
Also where the types were used I added .default, for example:
KristaHyer
changed the title
Imports don't work when NodeNext is used for module resolution
Example code in docs doesn't work when NodeNext is used for module resolution
Jan 24, 2025
Hi @KristaHyer , the IDBSQLSession is the default export of @databricks/sql/dist/contracts/IDBSQLSession and the generated IDBSQLSession.d.ts is correct and expected, it should work with both node and ES2022. I just verified your tsconfig.json with ES2022 and it can be compiled w/o error.
Using this tsconfig.json I can get the example code to build without error.
tsconfig.json:
Code from website - https://docs.databricks.com/en/dev-tools/nodejs-sql-driver.html#language-TypeScript:
However, when changing the tsconfig to use NodeNext (like the below):
I see the following error on the imports:
Cannot find module '@databricks/sql/dist/contracts/IDBSQLSession' or its corresponding type declarations.ts(2307)
Cannot find module '@databricks/sql/dist/contracts/IOperation' or its corresponding type declarations.ts(2307)
Versions:
The text was updated successfully, but these errors were encountered: