declare Builders type for builders() #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-type-of-builders"
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?
Description
This change provides a type that uses the schema and name of the builders argument to return the appropriate object.
Motivation
Until now, the only explicit return type of builder has been schema.
Therefore, to use the builder in a TypeScript project, it had to be cast to any.
How Has This Been Tested?
I wanted to modify test-mark.ts, but this file could not reflect the changes because it is imported from npm, not the source code.
I confirmed that any here can be removed, along with this one: https://github.com/ProseMirror/prosemirror-test-builder/pull/10
I have also confirmed that the type is valid in the test code of a private project I am involved in.
This code doesn't typecheck — you removed the
anycasts, but the type ofresultis such that they are in fact still needed there.fix to restore any casts. https://github.com/ProseMirror/prosemirror-test-builder/pull/9/commits/2cdbc9bea62f8cd21c7845c95ca72358944562a0