winglang/wing

improve error message when accessing an optional map property

Open

#2.020 geöffnet am 9. Apr. 2023

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (214 Forks)github user discovery
good first issue✨ enhancement🛠️ compiler

Repository-Metriken

Stars
 (5.385 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Feature Spec

Assuming we have an optional Map, and we want to access one of its properties, optional_map.get("property") (or even optional_map?.get("property")) will throw the following error: "property access unsupported on type Map?" this error message might not be clear enough to guide the user on how to fix the error.

(At the end I solved it this way:

let m = optional_map ?? {property: "x"};
m.get("property");

)

Use Cases

accessing a property on an optional map

Implementation Notes

We will also support optional_map?.property in the future

Component

Language Design

Community Note

Please vote by adding a 👍 reaction to the issue to help us prioritize. If you are interested to work on this issue, please leave a comment.

Contributor Guide