-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Improved Types #4119
Merged
Merged
Improved Types #4119
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ate experimental releases
clauderic
pushed a commit
to slate-rte/slate
that referenced
this pull request
May 3, 2021
* Experimental release to see if CustomTypes holds up through a publish * Add experimental release script * Fix lint * v0.60.5-alpha.0 * Allow null properties in setNodes * v0.60.6-alpha.0 * Revert null properties on Transforms.setNodes * v0.60.7-alpha.0 * Update examples to use custom Element and Text with discriminated unions * Add documentation for using TypeScript improvements * Be explicit about typescript version in package.json * Force lerna bootstrap to fix build issues on CI and fix a few type examples * Add slate devDependencies with * back * v0.60.7 * Switch to a non prerelease version to fix lerna not linking in root * Add documentation for not using prerelease versions and on how to create experimental releases * Try removing lerna bootstrap and see if it works
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This enables types to work with Element and Text objects with support for type discrimination. It also adds support for extending other objects like Editor, Range, Selection and Point; however, I would consider the customizing of those types as more experimental as I think there is a better way to do this.
This version of improved types only supports one type of Editor (ie. one set of customization) but you should be able to support multiple types by creating the editor in separate packages. This hasn't been tested though.
I've also:
Issue
Previously, an extended TypeScript PR was merged (into a
@next
release) based on a proposal that I had authored; however, the implementation had some issues that made it impossible to use. This PR was built alongside an actual implementation of an editor so should be usable with a real Editor.Fixes: #3725
Example
n/a
Context
The previous version of extended TypeScript had issues when resolving a
Node
because aNode
was a custom extension that was made up of other custom extensions likeElement
andText
. Removing these nested custom extensions was the solution to this problem.Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)IMPORTANT!
yarn test
does pass on my computer, but is showing errors in CI. I think this may be due to the CI using a different version of TypeScript.