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

feat(dx): instantiate all boundary types #76

Merged
merged 4 commits into from
Sep 19, 2021

Conversation

devanshj
Copy link
Contributor

@devanshj devanshj commented Aug 6, 2021

I was writing the documentation and realized the errors and quickinfo are horrible, I mean I knew it previously and I tried this before but apparently it did not work or I was doing it wrong, revisited it and now it works.

Basically typescript skips instantiating type for performance reasons and just shows it's name, but with A.Instantiate we force typescript to compute and instantiate it.

It comes with some cost that typescript has to do more work and in worst case it might result in "instantiation is too deep or possibly infinite" but I think that won't happen. Even if it happens we'll basically revert this and publish a patch, as it has got nothing to do with code only error messages and quickinfo.

The boundary positions are namely: state, send, effectParameter, effectCleanupParameter, guardParameter.

A few examples of the change

Before:

image

After:

image

Before:

image

After:

image

Before:

image

After:

image

Before:

image

After:

image

and other minor refactors
(list taken from ts-toolbelt/Misc/BuiltIn)
@devanshj devanshj marked this pull request as draft August 6, 2021 01:28
@devanshj
Copy link
Contributor Author

devanshj commented Aug 6, 2021

don't instantiate context, event and builtins

Meaning we preserve names for these things. For example, in the following case we preserve the name of context Something and not instantiate it to it's definition { foo: string }

Before:
image

After:
image

@devanshj devanshj marked this pull request as ready for review August 6, 2021 02:34
@cassiozen cassiozen merged commit bf9d7d4 into cassiozen:main Sep 19, 2021
@devanshj
Copy link
Contributor Author

@cassiozen could you publish a version with this so that I can see what types are shown on hover when I resume writing the documentation?

@devanshj devanshj mentioned this pull request Sep 25, 2021
@cassiozen
Copy link
Owner

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants