Skip to content

Missing auto import suggestions for UMD modules such as classnames #41761

Closed
@OliverJAsh

Description

@OliverJAsh
  • VSCode Version: 1.51.1
  • OS Version: 11.0.1

Steps to Reproduce:

import * as React from 'react';

const el = <div className={REPLACE_ME}>foo</div>;
  1. yarn add @types/classnames
  2. Erase REPLACE_ME and begin typing classNames

Does this issue occur when all extensions are disabled?: Yes

Expected: VS Code suggests an auto import of classNames from module 'classnames'.

Actual: no suggested auto import.

image

I believe this is something to do with the fact that classnames is defined as a UMD module. If I change the type definitions for classnames to remove the UMD definition, the auto import does work correctly:

image


Note that VS Code does correctly provide import suggestions after we've finished typing the identifier, when we move our cursor.

image

This issue is specifically about auto imports inside the suggestions that appear as you're typing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Auto-importEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions