Skip to content

Explore mapping C# spaces to ES modules #161

@elringus

Description

@elringus

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, Enum } from "bootsharp/sharp-space-a";
import { doY } from "bootsharp/sharp-space-b";

if (enum === Enum.Foo) ...

doX();
doY();

— instead of the current:

import { SharpSpaceA, SharpSpaceB } from "bootsharp";

if (enum === SharpSpaceA.Enum.Foo) ...

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or enhancement

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions