Add support for substitution type and internal utility types #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes: #2
typeParamSourceis expected to hold a local item ID, so putting a path in there will make the doc generator emit nonsense.Also, what kind of type gets the
Substitutionflag?The problem is that typescript will try to unwrap something like
Omitand replace it withPickimplementation. I didn't find a good way to represent it.I don't know the implementation details of
Substitutionflag, but if you rungetdocs-tswith following code, it will create use that flag:Maybe instead of throw errors, we can let users to pass in some options to handle the unknown types?
The representation of these kind of types seems pretty bizarre — no type with the name
Omitappears anywhere. Instead thetargetproperty of the type holdsPick<T, K>, but those parameters aren't even defined there. The only place where TS seems to hold this information is the syntax parse tree, but reconstructing types from that in a general way would require us to write logic for every syntax node kind, which doesn't seem like a reasonable direction to go in.I'll see if I can special case straightforward alias declarations where the type is simply a named type with parameters.
I agree. I think trying to construct the correct representation for complex types is not very useful. I'd rather keep the name of the type and add some comments on it.
The problem stop me using this package is that it will just throw errors for the type cannot be analyzed. It would be great if we can have some kind of common representation for this case.
Patch
3911b490d4adds a (disturbingly special-cased) solution for theOmittest case.b3d51a4055adds support for template literals (including their arguments). Does that help?I'll test the package with
defineComponentin vue to see if everything works fine.👍 Works perfectly now.
Closing since the solution is not good enough.
Pull request closed