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

Explore mapping C# spaces to ES modules #161

Open
elringus opened this issue Sep 26, 2024 · 0 comments
Open

Explore mapping C# spaces to ES modules #161

elringus opened this issue Sep 26, 2024 · 0 comments
Labels
enhancement New feature or enhancement

Comments

@elringus
Copy link
Owner

elringus commented Sep 26, 2024

Currently, all the bindings and associated types from the C# solution are dumped to a single file (index.mjs and bindings.g.d.ts) and are grouped via TypeScript namespaces. This is sub-optimal for both the DX and performance.

For DX it's preferable to group the exports under sub-modules instead of TypeScript namespaces, so that they can be imported in a more granular way, eg:

import { doX } from "bootsharp/sharp-space-a";
import { doY } from "bootsharp/sharp-space-b";

doX();
doY();

— instead of the current:

import { SharpSpaceA, SharpSpaceB } from "bootsharp";

SharpSpaceA.doX();
SharpSpaceB.doY();

Additionally, TypeScript namespaces usage is generally discouraged in favor of ES modules.

For performance, TypeScript compilers and linters prefer multiple smaller declaration files instead of a single large one. This also benefits tree shaking.

@elringus elringus added the enhancement New feature or enhancement label Sep 26, 2024
@elringus elringus added this to the First stable release milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant