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

fix: ts interface error #1772

Merged
merged 1 commit into from
Mar 24, 2023
Merged

Conversation

Justin-lu
Copy link
Contributor

在 TypeScript 中,使用 export interface 导出的接口,在引入时确实需要使用 import type 来声明。

这是因为 import type 声明的是类型,而不是值,这样可以避免在编译时将接口的定义包含在输出文件中,从而减小输出文件的大小。另外,使用 import type 还可以避免出现循环依赖的问题。

@CLAassistant
Copy link

CLAassistant commented Mar 23, 2023

CLA assistant check
All committers have signed the CLA.

@JackLian
Copy link
Collaborator

感谢PR!

  1. CLA 麻烦签一下
  2. PR 需要指向 develop 分支
  3. 关于import type 的最佳实践可以探讨下,这里找到一个作者的建议 Should I explicitly separate "import" and "import type" statements? microsoft/TypeScript#39861 (comment)

@Justin-lu Justin-lu force-pushed the fix-ts-interface-error branch from b848045 to e10168c Compare March 23, 2023 03:28
@Justin-lu Justin-lu changed the base branch from main to develop March 23, 2023 03:29
@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Patch coverage: 83.33% and no project coverage change.

Comparison is base (203568e) 85.20% compared to head (e10168c) 85.20%.

❗ Current head e10168c differs from pull request most recent head 41eebcd. Consider uploading reports for the commit 41eebcd to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1772   +/-   ##
========================================
  Coverage    85.20%   85.20%           
========================================
  Files          197      197           
  Lines         8645     8645           
  Branches      2074     2074           
========================================
  Hits          7366     7366           
  Misses        1196     1196           
  Partials        83       83           
Impacted Files Coverage Δ
packages/designer/src/designer/detecting.ts 96.66% <ø> (ø)
packages/designer/src/designer/location.ts 100.00% <ø> (ø)
...ges/designer/src/designer/setting/setting-field.ts 98.98% <ø> (ø)
...esigner/src/designer/setting/setting-prop-entry.ts 98.55% <ø> (ø)
...designer/src/designer/setting/setting-top-entry.ts 98.23% <ø> (ø)
packages/designer/src/document/node/props/prop.ts 99.39% <ø> (ø)
packages/designer/src/document/node/props/props.ts 100.00% <ø> (ø)
packages/designer/src/project/project.ts 95.97% <75.00%> (ø)
packages/designer/src/document/document-model.ts 94.82% <100.00%> (ø)
packages/designer/src/document/node/node.ts 92.15% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Justin-lu
Copy link
Contributor Author

感谢PR!

  1. CLA 麻烦签一下
  2. PR 需要指向 develop 分支
  3. 关于import type 的最佳实践可以探讨下,这里找到一个作者的建议 Should I explicitly separate "import" and "import type" statements? microsoft/TypeScript#39861 (comment)

1、2 done

3 的话,我只改了编译时报warning的情况

@Justin-lu
Copy link
Contributor Author

image

@liujuping
Copy link
Collaborator

image

这里有一个自动化没有执行通过,辛苦处理一下。

@Justin-lu Justin-lu force-pushed the fix-ts-interface-error branch from e10168c to 41eebcd Compare March 24, 2023 01:53
@Justin-lu
Copy link
Contributor Author

image

这里有一个自动化没有执行通过,辛苦处理一下。

Done

@liujuping liujuping merged commit fc964ec into alibaba:develop Mar 24, 2023
@Justin-lu Justin-lu deleted the fix-ts-interface-error branch March 24, 2023 02:41
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

Successfully merging this pull request may close these issues.

4 participants