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

Typescript import error (TS1444 and TS1371) #2373

Closed
mphouse16 opened this issue Jun 5, 2023 · 7 comments · Fixed by #2491
Closed

Typescript import error (TS1444 and TS1371) #2373

mphouse16 opened this issue Jun 5, 2023 · 7 comments · Fixed by #2491

Comments

@mphouse16
Copy link

Describe a bug.

Steps to reproduce:
When I tried to build my app, the type check failed with following errors:

Expected behavior:
No build error, and develop build(npm dev run) don't show these errors.

Screenshots:

node_modules/@editorjs/editorjs/types/events/block/Base.ts:1:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

1 import { BlockAPI } from '../../api';

node_modules/@editorjs/editorjs/types/events/block/Base.ts:1:10 - error TS1444: 'BlockAPI' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.

1 import { BlockAPI } from '../../api';

node_modules/@editorjs/editorjs/types/events/block/BlockAdded.ts:1:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/BlockAdded.ts:1:10 - error TS1444: 'BlockMutationEventDetail' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/BlockChanged.ts:1:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/BlockChanged.ts:1:10 - error TS1444: 'BlockMutationEventDetail' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/BlockMoved.ts:1:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/BlockMoved.ts:1:10 - error TS1444: 'BlockMutationEventDetail' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/BlockRemoved.ts:1:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/BlockRemoved.ts:1:10 - error TS1444: 'BlockMutationEventDetail' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.

1 import { BlockMutationEventDetail } from './Base';

node_modules/@editorjs/editorjs/types/events/block/index.ts:1:10 - error TS1444: 'BlockAddedEvent' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.

1 import { BlockAddedEvent, BlockAddedMutationType } from './BlockAdded';

4 import { BlockRemovedEvent, BlockRemovedMutationType } from './BlockRemoved';

Device, Browser, OS:
Desktop, Windows, Vite v4.3.9

Editor.js version:
2.27.0

Plugins you use with their versions:
Paragraph, AlignmentTune, NestedList, Undeline and some custom plugins (by me).

Solution was simple for me, just add 'type' those error modules..
like..
import type { BlockMutationEventDetail } from './Base';
but I'm not sure this solution is right.

Would you please reseach this issue?
Thank you in advance!

@Aksimka
Copy link

Aksimka commented Jul 6, 2023

Same here. Maybe you know some temporary solution? Now I cant start to use this lib because of this error

@mphouse16
Copy link
Author

Same here. Maybe you know some temporary solution? Now I cant start to use this lib because of this error

I wrote PR #2396. Check that. Not difficult code. If worked after applying, approval my PR plz.

@neSpecc
Copy link
Member

neSpecc commented Jul 6, 2023

@mphouse16 already checked, comments left

@Aksimka
Copy link

Aksimka commented Jul 11, 2023

Is it stucked? :( It looks like it needs to just delete one word in PR

@alexsaranin
Copy link

Who knows how to make a temporary solution?

@chenguzhen87
Copy link

Have it been solved?

@ferntheplant
Copy link
Contributor

PR #2396 seems stuck so I opened #2491 to quickly solve this using import type ...

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

Successfully merging a pull request may close this issue.

6 participants