define all jsdoc typedef in a seperate file

Solutions on MaxInterview for define all jsdoc typedef in a seperate file by the best coders in the world

showing results for - "define all jsdoc typedef in a seperate file"
Fátima
09 Jul 2017
1// user.js
2
3const checkAge = require('./user-helper')
4
5/**
6 * @typedef {Object} User
7 * @property {string} name
8 * @property {number} age
9 */
10
11/**
12 * @param {User} user
13 */
14const createUser = (user) => {
15  if (checkAge(user)) {
16    db.save(user)
17  }
18}
Aislinn
23 Jun 2016
1// user-helper.js
2
3/**
4 * @param {import('./user').User} user
5 */
6exports.checkAge = user => {
7  return user.age >= 18
8}