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

Add toposort to ensure outputs are printed in valid order #53

Open
sdboyer opened this issue May 19, 2022 · 1 comment
Open

Add toposort to ensure outputs are printed in valid order #53

sdboyer opened this issue May 19, 2022 · 1 comment
Labels
kind/bug Something isn't working

Comments

@sdboyer
Copy link
Contributor

sdboyer commented May 19, 2022

Currently, cuetsy prints its outputs in alphabetical order. TS is sensitive to ordering in its constant declarations, however, meaning that this:

interface Bar {
  N: number;
}

const defaultBar: Bar = {
  N: defaultFoo,
}

type Foo = number;
const defaultFoo: Foo = 4;

Is invalid because defaultFoo is declared after it is referenced in defaultBar. Consequently, we have to add a (stable) toposort to cuetsy such that its const outputs are in an acceptable order.

It'll also mean erroring on circular references, if any.

@sdboyer sdboyer changed the title Add toposort to ensure cuetsy outputs are printed in valid order Add toposort to ensure outputs are printed in valid order May 19, 2022
@sdboyer sdboyer added the kind/bug Something isn't working label May 19, 2022
@sdboyer sdboyer self-assigned this May 19, 2022
@sdboyer sdboyer removed their assignment Feb 7, 2023
@frossano-grafana
Copy link

we can re-discuss this later because if things are declared in order in the CUE file then it's not an issue

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
None yet
Development

No branches or pull requests

2 participants