Skip to content

Dts compiled from anonymous arrow functions cannot be automatically imported #40817

@yuxino

Description

@yuxino

TS Template added by @mjbvz

TypeScript Version: 4.0.3

Search Terms

  • d.ts
  • auto import
  • intellisense

  • Version: 1.49.1
  • Commit: 58bb7b2331731bf72587010e943852e13e6fd3cf
  • Date: 2020-09-16T23:21:17.533Z (4 days ago)
  • Electron: 9.2.1
  • Chrome: 83.0.4103.122
  • Node.js: 12.14.1
  • V8: 8.3.110.13-electron.0
  • OS: Darwin x64 19.3.0

Steps to Reproduce:

I am using a library called ahooks, but this is not the point, I found such a thing: dts compiled from anonymous arrow functions cannot be automatically imported ...

  1. yarn add ahooks
  2. typing useMouse in the vscode
  3. hit enter .. nothing happend

Screen Shot 2020-09-21 at 11 33 31 AM

Need to manually click to import

image

I looked at the source code for export default and it looks like this

export default () => {}

It will be compiled into dts like this

declare const _default: () => void;
export default _default;

Anything types like this cannot be imported automatically

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions