SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Track typescript import statements in a btree to deduplicate them

Open jsdt opened this issue 1 year ago • 1 comments

Description of Changes

When generating TS code, this tracks import statements in a set instead of a vector to avoid duplicates. With the previous code, you could have duplicate import statements if there are two enum cases with field types that require an import.

API and ABI breaking changes

None.

Expected complexity level and risk

  1. This is very simple and low risk.

Testing

This fixed an issue I had with this type:

#[derive(Debug, Clone, Copy, SpacetimeType, Hash, Eq, PartialEq)]
enum Role {
    Spectator,
    Player(Team),
    Spymaster(Team),
}

Previously the import for Team would get generated twice.

  • [x] Worked for previously failing example.

jsdt avatar Jul 09 '24 01:07 jsdt

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 03 '25 18:05 CLAassistant