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

Update to V3 of umzug does not appear to have compatible @types/umzug #603

Closed
redevill opened this issue Apr 21, 2023 · 7 comments
Closed

Comments

@redevill
Copy link

Attempting to upgrade to V3.2.1
Sequelize Storage
Sequelize V6.28
Node 16.15.0
Typescript (VERY RELEVANT)

As stated in the title - The typings when trying to use this in Typescript are not up to date with the new release.
Get many errors pointing to e.g. "Migration" interface is not exported. UpDownMigrationsOptions also claims to be missing. While They are plain to see in the index file.

TIA

@mmkal
Copy link
Contributor

mmkal commented Apr 21, 2023

The external typings should not be used with v3. Just remove the dependency.

@redevill
Copy link
Author

Just tried what you suggested:
This is the code import statement and below are the compilation errors.

import { Migration, Umzug, UpDownMigrationsOptions } from 'umzug';


Building Node Server
server/db/dbMgmt/ormFactory.ts:3:10 - error TS2724: '"umzug"' has no exported member named 'Migration'. Did you mean 'MigrationFn'?

3 import { Migration, Umzug, UpDownMigrationsOptions } from 'umzug';
~~~~~~~~~

server/db/dbMgmt/ormFactory.ts:3:28 - error TS2305: Module '"umzug"' has no exported member 'UpDownMigrationsOptions'.

3 import { Migration, Umzug, UpDownMigrationsOptions } from 'umzug';
~~~~~~~~~~~~~~~~~~~~~~~

server/services/db-admin.handlers.ts:5:10 - error TS2305: Module '"umzug"' has no exported member 'UpDownMigrationsOptions'.

5 import { UpDownMigrationsOptions } from 'umzug';
~~~~~~~~~~~~~~~~~~~~~~~

@redevill
Copy link
Author

FYI - did use the npm ci option to ensure a rebuild of the node modules. Also tried several other V3 tags - V3.2.1 , V3.0.0 and the first beta... all give the same errors.

@mmkal
Copy link
Contributor

mmkal commented Apr 21, 2023

See the error: Module '"umzug"' has no exported member 'UpDownMigrationsOptions'.. This is not an export of v3. I believe it also wasn't an official export of v2 - the types were originally maintained separately - so it's not documented in the migration guide. But, have a look at the readme to make sure you understand the differences between 2 and 3. If you'd like to add a note to the readme a PR would be welcome.

@redevill
Copy link
Author

redevill commented Apr 21, 2023

Not sure I understand - A primary public function in umzug V2 & V3 - is the method "up" as defined below:
up(options?: UpToOptions | UpDownMigrationsOptions): Promise<Migration[]>;

How am I to create a strongly typed options object "UpDownMigrationsOptions" to pass to the publicly defined method "up" if it is not exported?

Or is the intent of the library to remove the ability to supply options to the "up" method?

@mmkal
Copy link
Contributor

mmkal commented Apr 21, 2023

(Edited - sorry, I originally submitted partial message)

A primary public function in umzug V2 & V3 - is the method "up" as defined below:
up(options?: UpToOptions | UpDownMigrationsOptions): Promise<Migration[]>;

No it isn't:

async up(options: MigrateUpOptions = {}): Promise<MigrationMeta[]> {

Unless I'm misunderstanding you? Where in V3 did you find that code?

@mmkal mmkal closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2023
@redevill
Copy link
Author

Apologies - in the upgrade process, the old typings were not removed - causing my confusion.

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

No branches or pull requests

2 participants