-
-
Notifications
You must be signed in to change notification settings - Fork 765
Closed
Description
- I have checked issues with bug label and found no duplicates
Expected Behavior
I'm using the command:
typedoc src --json exported.json --target es6I expect the two arrow functions createAlarm and createAlarm2 to have the same json output (except for __namedParameters of course).
Actual Behavior
For createAlarm, Typedoc doesn't set the .isOptional flag to each parameter and outputs different types (e.g. repeat parameter type.elementType is directly an union instead of a reference, active parameter type contains true and false instead of boolean):
Steps to reproduce the bug
Run Typedoc on the following code:
type Frequency = (
'Sunday'
| 'Monday'
| 'Tuesday'
| 'Wednesday'
| 'Thursday'
| 'Friday'
| 'Saturday'
);
type Switch = (
'ON'
| 'OFF'
);
/**
* With destructured parameter
*
* - handles default values
* - flag.isOptional not working
* - reference type not working
*/
const createAlarm = (
{
/** The alarm active state */
active = true,
/** The alarm time */
time = '',
/** Whether the alarm should repeat on certain days */
repeat = [],
}: {
active?: boolean | Switch,
time?: string,
repeat?: Frequency[],
},
): string => `Alarm at ${time} every ${repeat.join(', ')} is ${active}`;
/**
* Without destructured parameter
*
* - doesn't handle default values
* - flag.isOptional works
* - reference type works
*/
const createAlarm2 = (
options: {
/** The alarm active state */
active?: boolean | Switch,
/** The alarm time */
time?: string,
/** Whether the alarm should repeat on certain days */
repeat?: Frequency[],
},
): string => {
const {
active = true,
time = '',
repeat = [],
} = options;
return `Alarm at ${time} every ${repeat.join(', ')} is ${active}`;
};Environment
- Typedoc version: 0.14.2
- TypeScript version: 3.2.4
- Node.js version: v10.13.0
- OS: macOS 10.14.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
