Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
How to get knexjs type definitions in migration files?

KnexJS type definitions work fine in all JS files where I import/require it. But in migrations there is no import/require due to no need of knex initializaion. Type definitions help avoiding error in properties and methods. How can I get type definitions in migration files for KnexJS then?

exports.up = function(knex) {
  // type definitions dont work here
};

exports.down = function(knex) {
  
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Well. AlhamduLILLAH. I found the answer myself.

/** @typedef {import('knex/types').Knex} knex */

/**
 * 
 * @param {knex} knex 
 */
export const up = async knex => {

  // Start here.. types work here!!

}

/**
 * 
 * @param {knex} knex 
 */
export const down = async knex => {

  // Start here.. types work here!!

}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!