Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List defaults #8

Closed
sh0rez opened this issue Mar 12, 2021 · 2 comments · Fixed by #27
Closed

List defaults #8

sh0rez opened this issue Mar 12, 2021 · 2 comments · Fixed by #27
Assignees
Labels
kind/bug Something isn't working

Comments

@sh0rez
Copy link
Member

sh0rez commented Mar 12, 2021

This currently panics:

I2: {
  I2_TypedList: [...int] | *[1,2]
} @cuetsy(targetType="interface")

Instead, it should generate an interface with a number[] field and a default const with [1,2]

@sdboyer sdboyer added the kind/bug Something isn't working label Aug 17, 2021
@ying-jeanne ying-jeanne self-assigned this Aug 24, 2021
@ying-jeanne ying-jeanne added this to the 8.2.0 milestone Aug 30, 2021
@ying-jeanne ying-jeanne added this to To do in Grafana Backend (DO NOT USE!) via automation Aug 30, 2021
@ying-jeanne ying-jeanne moved this from To do to In progress in Grafana Backend (DO NOT USE!) Aug 31, 2021
@ying-jeanne ying-jeanne linked a pull request Aug 31, 2021 that will close this issue
@ying-jeanne ying-jeanne moved this from In progress to Under review in Grafana Backend (DO NOT USE!) Aug 31, 2021
@ying-jeanne
Copy link
Collaborator

we need to distinguish somehow the list intent to be empty default or the case when it is just false return of cue.default()

@ying-jeanne
Copy link
Collaborator

ying-jeanne commented Sep 9, 2021

the current pr works for a homogeneous list with or without defaults.

Defining array with multiple types in TypeScript

Use a union type (string|number)[] demo:

If list contains only two elements [number, string] we can declare it as a tuple:
const foo: [number, string] = [ 1, "message" ];

we can also support union and tuple?(maybe not) in the following stage.

Grafana Backend (DO NOT USE!) automation moved this from Under review to Done Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants