Skip to content
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

Use isolatedModules for easier compatibility with Deno (and others) #827

Merged
merged 1 commit into from
Dec 29, 2021

Conversation

bradenmacdonald
Copy link
Contributor

This PR changes the driver's TypeScript code to use TypeScript's stricter isolatedModules flag.

isolatedModules is required to support some transpilers that operate on a single file at a time, so they can tell which imports/exports contain only type information and are safe to discard. This change is more "strict" and does not change the API, so is completely backwards compatible.

Rationale: The reason for this PR is to allow a common codebase to work for both Node.js and Deno. While TypeScript/Node don't care if isolatedModules is enabled or not, Deno requires it. So this is a prerequisite to supporting Deno. See the relevant forum discussion. I will soon be opening a PR that shows how to generate a Deno driver, which depends on this change.

Without this change, Deno will report this TypeScript error when trying to transpile the driver code:

Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

Copy link
Contributor

@bigmontz bigmontz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

Thanks for your contribution.

Just waiting the pipeline go green to

@bigmontz bigmontz merged commit bc6b388 into neo4j:4.4 Dec 29, 2021
@bradenmacdonald bradenmacdonald deleted the isolatedModules branch December 29, 2021 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants