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

ts类型提示 || ts type hints #76

Open
zyh2123606 opened this issue Jul 7, 2023 · 1 comment
Open

ts类型提示 || ts type hints #76

zyh2123606 opened this issue Jul 7, 2023 · 1 comment

Comments

@zyh2123606
Copy link

zyh2123606 commented Jul 7, 2023

对于远程组件,基座应用共享的组件库在插件里使用时没有了ts类型提示与检查,有没有什么好的办法或建议


For remote components, the component library shared by the base application does not have ts type hints and checks when used in plug-ins. Is there any good way or suggestion

@github-actions github-actions bot changed the title ts类型提示 ts类型提示 || ts type hints Jul 7, 2023
@moonrailgun
Copy link
Owner

moonrailgun commented Jul 7, 2023

如果你的项目还是放在一起的话,即相互之间路径是固定的,则可以使用tsconfig配置路径声明,如下:

{
  "compilerOptions": {
    "paths": {
      "@capital/*": ["../../../src/plugin/*"],
    }
  }
}

如果你的项目是分开放置的,一种是抽象代码到独立的工具库中,一种是手动使用ast工具生成类型文件。(这种方式因人而异)


If your projects are still put together, that is, the paths between each other are fixed, you can use tsconfig to configure the path statement, as follows:

{
  "compilerOptions": {
    "paths": {
      "@capital/*": ["../../../src/plugin/*"],
    }
  }
}

If your projects are placed separately, one is to abstract the code into an independent tool library, and the other is to manually use the ast tool to generate type files. (This method varies from person to person)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants