Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Proper type documentation for @returns with "type | type" #287

Closed
csentis opened this issue Aug 19, 2017 · 2 comments
Closed

[FEATURE] Proper type documentation for @returns with "type | type" #287

csentis opened this issue Aug 19, 2017 · 2 comments

Comments

@csentis
Copy link

csentis commented Aug 19, 2017

Overview of the issue

Currently, documentation for functions that return either one type or another is not being generated properly. This feature request aims at overcoming this.

Operating System, Node.js, npm, compodoc version(s)

Win10, Node 8.1.3, yarn 0.24.6, compodoc 1.0.0-beta.14

Compodoc installed globally or locally ?

locally

Motivation or Use Case

I have a custom validator returning either a literal type or null.

The documentation generated by compodoc prints out Type: literal type| in this case.
It should generate either Type: literal type or null (with CSS classes for code used) or Type: literal type | null.

Example generating Type: literal type|:

        /**
         * Validates whether passwords match and returns the result of the validation.
         *
         * @param {AbstractControl} a The form control to be validated.
         * @param {string} pwControl The name of the control containing the password to match with the password confirmation.
         * @param {string} pwConfirmControl The name of the control containing the password confirmation to match with the password.
         * @returns {{passwordMismatch:boolean}|null} `passwordMismatch` set to true in case of mismatch in password; `null` in case of matching passwords.
         */
        pwMatchValidatorNew(a: AbstractControl, pwControl: string, pwConfirmControl: string): { passwordMismatch: boolean } |null {

            return (a.get(pwControl).value !== a.get(pwConfirmControl).value &&
                a.get(pwControl).dirty === true && a.get(pwConfirmControl).dirty === true)
                ? { 'passwordMismatch': true } : null;
        };

Kindly note that I am not sure I am using the literal type n the right hand side of the function statement properly myself.

@csentis
Copy link
Author

csentis commented Aug 21, 2017

@vogloblinsky I confirm b7d3406 (using https://github.com/compodoc/compodoc#develop as of today, now) to work as expected. You are setting high standards here, Vincent!

@lock
Copy link

lock bot commented Oct 1, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants