Skip to content

False positives on export (destructuring) missing key object with default value #918

Closed
@ardok

Description

@ardok
// constants.js
export const {
  a: {
    // `b` would have been undefined, but we will default the value with a string
    b = 'default value',
  },
} = {
  a: {
    // `b` doesn't exist here
    c: 'test',
  },
};

...

// foo.js
import {b} from './constants';

// And it results in
 error  b not found in './constants'  import/named

It shouldn't throw an error because we have a default value for the key there.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions