How to mark isOptional to true when using functions?
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5k
- Forks
- 162
- Avg merge
- 17h 24m
- Merged PRs (30d)
- 8
Description
How to mark options as optional for this case? as it already has the ? but when using ApiParameterListMixin, it does not seen to have isOptional as true.
/**
* Adds auto-animate to each input automatically.
*
* @param options - {@link https://github.com/formkit/auto-animate/blob/master/src/index.ts#L596 | AutoAnimateOptions }
* @returns A compatible plugin to FormKit
*
* @public
*/
export function createAutoAnimatePlugin(
options?: AutoAnimateOptions
): FormKitPlugin {
the code using it is
(apiItem as ApiParameterListMixin).parameters.forEach(
(parameter) => {
const isOptional = parameter.isOptional ? '?' : '';
console.log(parameter);
parameters.push(`${parameter.name}${isOptional}: ${parameter.parameterTypeExcerpt.text.trim()}`);
}
)
// Gives this
<ref *1> Parameter {
name: 'options',
parameterTypeExcerpt: Excerpt {
tokens: [
[ExcerptToken],
[ExcerptToken],
[ExcerptToken],
[ExcerptToken],
[ExcerptToken]
],
tokenRange: [Object: null prototype] { startIndex: 1, endIndex: 2 },
spannedTokens: [ [ExcerptToken] ]
},
isOptional: false,
_parent: ApiFunction {
_tsdocComment: DocComment {
configuration: [TSDocConfiguration],
summarySection: [DocSection],
remarksBlock: undefined,
privateRemarks: undefined,
deprecatedBlock: undefined,
params: [DocParamCollection],
typeParams: [DocParamCollection],
returnsBlock: [DocBlock],
modifierTagSet: [StandardModifierTagSet],
_seeBlocks: [],
_customBlocks: []
},
_excerptTokens: [
[ExcerptToken],
[ExcerptToken],
[ExcerptToken],
[ExcerptToken],
[ExcerptToken]
],
_excerpt: Excerpt {
tokens: [Array],
tokenRange: [Object],
spannedTokens: [Array]
},
_fileUrlPath: undefined,
_parent: ApiEntryPoint {
_parent: [ApiPackage],
_canonicalReference: undefined,
[Symbol(ApiNameMixin._name)]: '',
[Symbol(ApiItemContainerMixin._members)]: [Array],
[Symbol(ApiItemContainerMixin._membersSorted)]: true,
[Symbol(ApiItemContainerMixin._membersByContainerKey)]: [Map],
[Symbol(ApiItemContainerMixin._preserveMemberOrder)]: false,
[Symbol(ApiItemContainerMixin._membersByName)]: undefined,
[Symbol(ApiItemContainerMixin._membersByKind)]: undefined
},
_canonicalReference: undefined,
[Symbol(ApiExportedMixin._isExported)]: true,
[Symbol(ApiReturnTypeMixin._returnTypeExcerpt)]: Excerpt {
tokens: [Array],
tokenRange: [Object: null prototype],
spannedTokens: [Array]
},
[Symbol(ApiReleaseTagMixin._releaseTag)]: 4,
[Symbol(ApiParameterListMixin._overloadIndex)]: 1,
[Symbol(ApiParameterListMixin._parameters)]: [ [Circular *1] ],
[Symbol(ApiTypeParameterListMixin._typeParameters)]: [],
[Symbol(ApiNameMixin._name)]: 'createAutoAnimatePlugin'
}
}
// function createAutoAnimatePlugin(options: AutoAnimateOptions)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ApiParameterListMixin parameter metadata and the TypeScript function example in the issue. Determine why the optional options parameter is reported with isOptional: false, then verify the expected representation for createAutoAnimatePlugin and document or test the resolved behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100