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

feat: export interfaces from schema-builder/options #8383

Merged
merged 1 commit into from Nov 18, 2021
Merged

feat: export interfaces from schema-builder/options #8383

merged 1 commit into from Nov 18, 2021

Conversation

navarroaxel
Copy link
Contributor

@navarroaxel navarroaxel commented Nov 18, 2021

Description of change

Export options interfaces from 'src/schema-builder/options', making them
usable in migrations, e.g.:

import { TableColumnOptions } from 'typeorm';

This fix a type error when you use:

const columnOptions = {
   name: 'uuid',
  type: 'uuid',
  isGenerated: true,
  generationStrategy: 'uuid',
  default: 'uuid_generate_v4()',
  isNullable: false,
  isUnique: true,
};
await queryRunner.addColumn('Users', columnOptions);

TS2345: Argument of type '{ name: string; type: string; isGenerated: boolean; generationStrategy: string; default: string; isNullable: boolean; isUnique: boolean; }' is not assignable to parameter of type 'TableColumnOptions'.   Types of property 'generationStrategy' are incompatible.     Type 'string' is not assignable to type '"uuid" | "increment" | "rowid" | "identity"'

TypeScript v4.4 / v4.5.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

Export options interfaces from 'src/schema-builder/options', making them
usable in migrations, e.g.:
import { TableColumnOptions } from 'typeorm';
@pleerock pleerock merged commit 7b8a1e3 into typeorm:master Nov 18, 2021
@navarroaxel navarroaxel deleted the patch-1 branch November 18, 2021 13:29
HeartPattern pushed a commit to HeartPattern/typeorm that referenced this pull request Nov 29, 2021
Export options interfaces from 'src/schema-builder/options', making them
usable in migrations, e.g.:
import { TableColumnOptions } from 'typeorm';
HeartPattern pushed a commit to HeartPattern/typeorm that referenced this pull request Nov 29, 2021
Export options interfaces from 'src/schema-builder/options', making them
usable in migrations, e.g.:
import { TableColumnOptions } from 'typeorm';
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

Successfully merging this pull request may close these issues.

None yet

2 participants