Skip to content

Optional and already-fulfilled properties should have lower priorities than required properties #29868

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

Closed
DanielRosenwasser opened this issue Feb 12, 2019 · 0 comments · Fixed by #32266
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 12, 2019

I ran into this while trying to implement TypeScript's ParseConfigFileHost with an object spread, and I've been seeing this come up in my experience in general.

interface Something {
    a?: number;
    b: number;
    c?: string;
    d: string;
}

const thing: Something = {
    /*$*/    
}

Expected: Completions show b, d, a, c.
Actual: Completions show a, b, c, d.

image

Furthermore, already fulfilled properties should be even lower than optional properties.

interface Something {
    a?: number;
    b: number;
    c?: string;
    d: string;
}

const foo = {
    a: 100,
    b: 100,
}

const thing: Something = {
    ...foo,
    /*$*/    
}

Expected: d, c, a, b
Actual: a, b, c, d

image

@DanielRosenwasser DanielRosenwasser added Suggestion An idea for TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor labels Feb 12, 2019
@DanielRosenwasser DanielRosenwasser added Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this labels Jun 24, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants