Skip to content

🛠 Repo: Split type declarations into standalone .d.ts files #5347

Open
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Tooling Suggestion Checklist

Overview

Mocha defines all code types with JSDoc comments in .js files right now. For example, this is how PluginDefinition is declared:

mocha/lib/mocha.js

Lines 1309 to 1316 in 945d6e3

/**
* An object making up all necessary parts of a plugin loader and aggregator
* @typedef {Object} PluginDefinition
* @property {string} exportName - Named export to use
* @property {string} [optionName] - Option name for Mocha constructor (use `exportName` if omitted)
* @property {PluginValidator} [validate] - Validator function
* @property {PluginFinalizer} [finalize] - Finalizer/aggregator function
*/

That type block becomes https://mochajs.org/api/global#PluginDefinition.

We'd like to move to .d.ts files for declaring these typedefs for a few reasons:

Additional Info

We're not committing to converting existing *.js files to *.ts - runtime source code will stay in JS-land for now. That's a separate discussion

Metadata

Metadata

Labels

area: repository toolingconcerning ease of contributioncore-teamissues which must be handled by Mocha's core team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions