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

importsNotUsedAsValues deprecation #826

Closed
Renegade334 opened this issue Sep 23, 2023 · 1 comment · Fixed by #831
Closed

importsNotUsedAsValues deprecation #826

Renegade334 opened this issue Sep 23, 2023 · 1 comment · Fixed by #831
Labels

Comments

@Renegade334
Copy link
Contributor

Renegade334 commented Sep 23, 2023

discord-api-types has used tsconfig's importsNotUsedAsValues: "error" since 0.20.0. It stops ESModule-style imports being used without the type specifier; for instance:

import type { Snowflake } from '../globals';

is fine, but

import { Snowflake } from '../globals';
// This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. ts(1371)

gets rejected by the compiler.

importsNotUsedAsValues was deprecated in TS 5.0, and will be removed in 5.5. Its replacement, verbatimModuleSyntax, provides different functionality: although it does cover the above import case, it also prevents top-level value exports in CommonJS modules:

import { Snowflake } from '../globals';
// Snowflake' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. ts(1484)

export const GatewayVersion = '10';
// A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled. ts(1287)

Since moving to eslint-config-neon, type import behaviour is enforced by @typescript-eslint/consistent-type-imports anyway, so removing the flag entirely might be the easiest solution.

@Jiralite Jiralite changed the title build(tsconfig): importsNotUsedAsValues deprecation importsNotUsedAsValues deprecation Sep 23, 2023
@vladfrangu
Copy link
Member

Feel free to PR the removal of the flag!

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

Successfully merging a pull request may close this issue.

3 participants