Skip to content

Differing JavaScript suggestion diagnostics in editor #2037

@DanielRosenwasser

Description

@DanielRosenwasser
export class MyCache {
    constructor() {
        this.cache = new Map();
    }

    set(key, value) {
        this.cache.set(key, value);
        this.evictable.set(key, false);
    }

    setEvictable(key, evictable) {
        this.evictable.set(key, evictable);
    }
}

TS 6 behavior:

export class MyCache {
    constructor() {
        this.cache = new Map();
    }

    set(key, value) {
        this.cache.set(key, value);
        this.evictable.set(key, false);
        //   ^💭
        // Property 'evictable' may not exist on type 'Cache'. Did you mean 'setEvictable'?
    }

    setEvictable(key, evictable) {
        this.evictable.set(key, evictable);
        //   ^💭
        // Property 'evictable' may not exist on type 'Cache'. Did you mean 'setEvictable'?
    }
}

TS 7

export class MyCache {
    constructor() {
        this.cache = new Map();
    }

    set(key, value) {
    //  ^    ^💭
    // Parameter '...' implicitly has an 'any' type, but a better type may be inferred from usage.
        this.cache.set(key, value);
        this.evictable.set(key, false);
    }

    setEvictable(key, evictable) {
        //       ^    ^💭
        // Parameter '...' implicitly has an 'any' type, but a better type may be inferred from usage.
        this.evictable.set(key, evictable);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: JSRelated to JS parsing, checkingbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions