Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Create Function with Types crashes when argument is an array #17

Closed
automatensalat opened this issue May 26, 2020 · 3 comments
Closed
Labels
🐛 Bug Something isn't working

Comments

@automatensalat
Copy link
Contributor

Describe the bug

When using the "Create function" (with types) action on a function that takes an array the action is not provided as a code fix. If I execute it via the command palette I receive an error:

// hocuspocus.ts
function bla() {
	const c: number[] = [1, 2, 3];
	doSomething(c);
}

Select doSomething and perform the action ->

Something went wrong: Error: Cannot find module 'typescript'
Require stack:
- /home/tobias/.vscode/extensions/nicoespeon.hocus-pocus-1.4.0/out/extension.js
- /usr/share/code/resources/app/out/vs/loader.js
- /usr/share/code/resources/app/out/bootstrap-amd.js
- /usr/share/code/resources/app/out/bootstrap-fork.js

How to reproduce

Just copy the above code into a .ts file and perform the action on doSomething.

Expected behavior

It should generate the function with the correct param type, in this case number[].

Additional information

  • Version of the extension impacted: v1.4.0

Here's my installed TS versions if it helps:

# TS not installed globally
tobias@tobias-Precision-3541:~/git/lofino-backend$ npm ls -g | grep typescript
│ │ │ │   ├─┬ @babel/plugin-transform-typescript@7.7.4
│ │ │ │   │ └─┬ @babel/plugin-syntax-typescript@7.7.4
tobias@tobias-Precision-3541:~/git/lofino-backend$ npm ls | grep typescript
├─┬ @typescript-eslint/eslint-plugin@2.11.0
│ ├─┬ @typescript-eslint/experimental-utils@2.11.0
│ │ ├── @typescript-eslint/typescript-estree@2.11.0 deduped
├─┬ @typescript-eslint/parser@2.11.0
│ ├── @typescript-eslint/experimental-utils@2.11.0 deduped
│ ├─┬ @typescript-eslint/typescript-estree@2.11.0
├── typescript@3.8.3
@automatensalat automatensalat added the 🐛 Bug Something isn't working label May 26, 2020
@nicoespeon
Copy link
Owner

Weird, "typescript" is part of the dependencies. Also, it worked during debug. I didn't tested the compiled version, maybe the issue lies in prod bundle 🤔

Thanks for reporting!

@OliverJAsh
Copy link

FYI I'm also running into this

@nicoespeon
Copy link
Owner

Hey, thanks for reporting but it's been a while since I updated this extension and I'm not planning to do this in the foreseeable future. I'm archiving the extension 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants