Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Add record type #6

Open
CharString opened this issue Nov 10, 2023 · 0 comments
Open

Add record type #6

CharString opened this issue Nov 10, 2023 · 0 comments

Comments

@CharString
Copy link
Collaborator

CharString commented Nov 10, 2023

Currently the data

{
  "voornaam": "",
  "nettoBedragAOQ": 0,
  "werkgevers": [{"nettoLoon": 0, "periodeNettoLoon": "week"}],
  "uitkeringen": {
    "ww": false,
    "anw": false,
    "aow": false,
    "nee": false,
    "wao": false,
    "wia": false,
    "wajong": false,
    "bijstand": false,
    "ziektewet": false
  }
}

Does add werkgevers.0.nettoLoon :: number to the context... But a ty-var is created for the type of array werkgevers :: Array var. This is effectively the same as let werkgevers: any[].

A mismatch in a "map" over werkgevers that uses nettoLoon as a string goes unnoticed.

@CharString CharString changed the title Add record type Add record/map type Nov 10, 2023
@CharString CharString changed the title Add record/map type Add record type Nov 10, 2023
CharString added a commit to open-formulieren/open-forms that referenced this issue Nov 14, 2023
Forces expressions of type `string[][]`.

Accepting `[value: any, label: string][]` would require
open-formulieren/InferNoLogic#5

To allow

```ts
type Item = [value: any, label: string] | {value: any, label: string}
type ValidItemExpression = Item[]
```

open-formulieren/InferNoLogic#6 and even a union type!
CharString added a commit to open-formulieren/open-forms that referenced this issue Nov 16, 2023
Forces expressions of type `string[][]`.

Accepting `[value: any, label: string][]` would require
open-formulieren/InferNoLogic#5

To allow

```ts
type Item = [value: any, label: string] | {value: any, label: string}
type ValidItemExpression = Item[]
```

open-formulieren/InferNoLogic#6 and even a union type!
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant