azu / azu/babel-plugin-jsdoc-to-assert

Feature request: Support for `typedef`

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
Patch Welcome
Dominant language
JavaScript
Stars
55
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I guess that's not yet supported? I couldn't find a test for `typedef` definitions.

I use a lot of code like this to define backend's data transfer objects before I pass them to my client side model classes:

```js
/**
* @typedef {Object} MyDataDTO
* @property {string} foo -
* @property {string} bar -
*/

/**
* @typedef {Object} MyResponseDTO
* @property {MyDataDTO} payload -
* @property {number} status -
*/

/**
*/
class MyData {

/**
* @param model {MyDataDTO}
*/
constructor (model) {
this._model = model;
}

// ...
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the plugin currently recognizes JSDoc type definitions and reviewing its existing tests for related annotations. Add coverage for the nested `@typedef` examples in the issue, including `@property` references and constructor parameter usage, then verify that the expected runtime assertions are produced.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.