Skip to content

chore(db-*): import migration args as type #12020

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sondreorland
Copy link
Contributor

What?

If you have verbatimModuleSyntax enabled in tsconfig then creating migrations will give a TypeScript error due to the args not being imported as types.

When a migration is created we get this:

import { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/db-mongodb'

Why?

This causes:

'MigrateDownArgs' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
'MigrateUpArgs' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

Screenshot:
Screenshot 2025-04-05 at 15 37 44

How?

Added type in front of the imported types to avoid the error, which also makes it clearer that this is a type import.

import type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/db-mongodb'

@sondreorland sondreorland force-pushed the import-type-migrations branch 2 times, most recently from 040f983 to 6e54caa Compare April 7, 2025 08:31
@sondreorland sondreorland force-pushed the import-type-migrations branch from 6e54caa to 12773c1 Compare April 15, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant