feat(migration): improve JSDoc types in generated migration templates (#11490)

* Feat: add JSDoc typing for queryRunner parameter

* Feat: add JSDoc typing for queryRunner parameter
This commit is contained in:
Victor Shymko 2025-09-17 00:27:03 +03:00 committed by GitHub
parent 6e92aad5d0
commit fa3cd436a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -109,6 +109,7 @@ export class ${camelCase(
const exportMethod = esm ? "export" : "module.exports ="
return `/**
* @typedef {import('typeorm').MigrationInterface} MigrationInterface
* @typedef {import('typeorm').QueryRunner} QueryRunner
*/
/**
@ -117,9 +118,15 @@ export class ${camelCase(
*/
${exportMethod} class ${camelCase(name, true)}${timestamp} {
/**
* @param {QueryRunner} queryRunner
*/
async up(queryRunner) {
}
/**
* @param {QueryRunner} queryRunner
*/
async down(queryRunner) {
}

View File

@ -270,6 +270,7 @@ ${downSqls.join(`
return `/**
* @typedef {import('typeorm').MigrationInterface} MigrationInterface
* @typedef {import('typeorm').QueryRunner} QueryRunner
*/
/**
@ -279,11 +280,17 @@ ${downSqls.join(`
${exportMethod} class ${migrationName} {
name = '${migrationName}'
/**
* @param {QueryRunner} queryRunner
*/
async up(queryRunner) {
${upSqls.join(`
`)}
}
/**
* @param {QueryRunner} queryRunner
*/
async down(queryRunner) {
${downSqls.join(`
`)}