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

command/CommandHandler.ts import bug #864

Open
huang-long opened this issue Mar 7, 2024 · 8 comments
Open

command/CommandHandler.ts import bug #864

huang-long opened this issue Mar 7, 2024 · 8 comments
Labels
backlog Queued in backlog bug Something isn't working spring cleaning Could be cleaned up one day

Comments

@huang-long
Copy link

huang-long commented Mar 7, 2024

Describe the Bug

TypeScript compiler reports an error if I compile bpmn-js with verbatimModuleSyntax:

[PRJ]/diagram-js/lib/features/outline/OutlineProvider.spec.ts:
    6:10  error   'Element' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. ​typescript(1484)
    8:8   error   'OutlineProvider' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. ​typescript(1484)
    8:27  error   'Outline' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. ​typescript(1484)

Steps to Reproduce

  • Configure verbatimModuleSyntax in tsconfig.json.
  • npm run check-types

Expected Behavior

  • Building works with that setting, too.
@huang-long huang-long added the bug Something isn't working label Mar 7, 2024
@nikku
Copy link
Member

nikku commented Mar 11, 2024

@huang-long What exactly is your feature request?

@nikku nikku added the needs more information Requires additional information to be actionable. label Mar 11, 2024
@huang-long
Copy link
Author

@huang-long What exactly is your feature request?
When I use "diagram-js" in my project, and run "npm run build:prod", typescript checks error in the file "command/CommandHandler.ts", error message: [This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'].
error

@nikku
Copy link
Member

nikku commented Mar 11, 2024

@huang-long I tried to reproduce locally but found that you're using an old (ancient?) TypeScript version (<= 5.0).

Can you reproduce the issue with TypeScript@5?

@huang-long
Copy link
Author

I tried using TypeScript@5.0.4, but got the same error.I read the content of file “/diagram-js/lib/command/CommandHandler.ts”,the module “ElementLike、CommandContext” should be type.
So I modified the file “/diagram-js/lib/command/CommandHandler.ts” as first commented, build success.

import type { ElementLike } from "../core/Types"; import type { CommandContext } from "./CommandStack";

@nikku
Copy link
Member

nikku commented Mar 12, 2024

I believe you have verbatimModuleSyntax enabled, right? Enabling it in diagram-js leads to similar issues during type checking:

[PRJ]/diagram-js/lib/features/outline/OutlineProvider.spec.ts:
    6:10  error   'Element' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. ​typescript(1484)
    8:8   error   'OutlineProvider' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. ​typescript(1484)
    8:27  error   'Outline' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. ​typescript(1484)

@huang-long
Copy link
Author

No,I did not use this “verbatimModuleSyntax” in the tsconfig.This is my project ruoyi-web-vue3-ts

@nikku
Copy link
Member

nikku commented Mar 13, 2024

You use TypeScript@5 with deprecation warnings disabled, and importNotUsedAsValues. Later versions of @vue/tsconfig enable verbatimModuleSyntax.

We don't support that setting to date, but may investigate how to support it in the future.

@nikku nikku added backlog Queued in backlog spring cleaning Could be cleaned up one day and removed needs more information Requires additional information to be actionable. labels Mar 13, 2024
@huang-long
Copy link
Author

Thanks for answering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog bug Something isn't working spring cleaning Could be cleaned up one day
Development

No branches or pull requests

2 participants