Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add autocompletion when importing libraries #182

Open
FreePhoenix888 opened this issue Jul 10, 2023 · 7 comments · May be fixed by #183
Open

feature: add autocompletion when importing libraries #182

FreePhoenix888 opened this issue Jul 10, 2023 · 7 comments · May be fixed by #183
Assignees
Labels
enhancement New feature or request

Comments

@FreePhoenix888
Copy link
Member

FreePhoenix888 commented Jul 10, 2023

Code

async ({require}) => {
  const { Link } = require('@deep-foundation/deeplinks/imports/minilinks'); 
  const link: Link<number> = {
    // When I write here I want to see autocompletion
}

Additional Information

If we create interface inside our root function and use the interface - typescript works fine. The problem is related only to the require parameter that is of type any and Typescript does not know what that require can return. It is not the same as using builtin require

@FreePhoenix888 FreePhoenix888 added the enhancement New feature or request label Jul 10, 2023
@FreePhoenix888 FreePhoenix888 moved this to Todo in Development Jul 10, 2023
@FreePhoenix888
Copy link
Member Author

I have found this solution on stackoverflow: https://stackoverflow.com/a/52294684/13545849
But what If there are two entities with the same exported from two different packages?

Look at this demo

@FreePhoenix888
Copy link
Member Author

I like this answer: https://stackoverflow.com/a/65555804/13545849

@FreePhoenix888
Copy link
Member Author

FreePhoenix888 commented Jul 10, 2023

lukasbach/monaco-editor-auto-typings#7 (comment)
Unable to resolve package names with '@'
:(

@FreePhoenix888 FreePhoenix888 linked a pull request Jul 10, 2023 that will close this issue
@FreePhoenix888 FreePhoenix888 changed the title feature: Support types feature: add autocompletion when importing libraries Jul 10, 2023
@FreePhoenix888 FreePhoenix888 self-assigned this Jul 10, 2023
@FreePhoenix888 FreePhoenix888 moved this from Todo to In Progress in Development Jul 10, 2023
@FreePhoenix888
Copy link
Member Author

@Konard , I need to know how bundler will be working because this information can help me how I should add types to monacoeditor: https://chat.openai.com/share/85140d0d-25db-45a6-8d37-0151faf9507d

@Konard
Copy link
Member

Konard commented Jul 12, 2023

@FreePhoenix888 it is planned to work using require function.

@FreePhoenix888
Copy link
Member Author

@FreePhoenix888 it is planned to work using require function.

This is not what I want to hear.
I want to know is there is some info about bundler that I can use for this issue? Should I use typeRoots option?
If no - how should Monaco editor understand types of which dependencies needs to be added? Depending on the code?
If yes - what if the package is not installed in isolation provider? Will this problem be solved with bundler or what? Please give me as descriptive answer as you can. I need to solve my puzzle

@Konard
Copy link
Member

Konard commented Jul 12, 2023

@FreePhoenix888 with bundler no packages will be installed into isolation provider, most of them will be removed. Bundler creates a bundle when package is installed in Deep. The bundle is stored in database. I need to know which data is required for Monaco editor to do typing support. May be bundler itself is not enough, because it creates bundle using webpack, and the output result is single javascript file. At the moment I'm not sure how it will work with .d.ts files and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants