Skip to content

[fix] Fallback to string keys in maps#71

Merged
bulldozer-bot[bot] merged 1 commit intodevelopfrom
fo/string-keys
Nov 20, 2018
Merged

[fix] Fallback to string keys in maps#71
bulldozer-bot[bot] merged 1 commit intodevelopfrom
fo/string-keys

Conversation

@ferozco
Copy link
Copy Markdown
Contributor

@ferozco ferozco commented Nov 20, 2018

Before this PR

We would generate key types by resolving the type of the key. This caused definitions with maps containing booleans and doubles as keys to generate invalid TypeScript.

After this PR

We fall back to string on any type which is not a string or an enum

@ferozco ferozco requested a review from a team as a code owner November 20, 2018 16:40
@dansanduleac
Copy link
Copy Markdown
Contributor

Currently, this still means that the double keys 0 and 0.0 will be different items in the map (since even the javascript equality on double values considers them different). There's not much we can do about that while javascript doesn't offer a meaningful equality relation.

However, once we finish defining the RFC for deduping map keys and set items we should add custom logic to dedupe keys correctly based on their conjure types.

@bulldozer-bot bulldozer-bot Bot merged commit dc0b2dd into develop Nov 20, 2018
@bulldozer-bot bulldozer-bot Bot deleted the fo/string-keys branch November 20, 2018 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants