Comments (5)
Is this causing issues and if so what? The desire is to overload this function for ScrollBlot's needs for an array of mutations and ScrollBlot only pass context as the only parameter when it calls its superclass's optimize. The Typescript does not complain so I'm not seeing why it would be invalid.
from parchment.
The TypeScript compiler error only appears for me with the option strictNullChecks
turned on. Since neither JS nor TS support method overloading, overridden methods need to be typeable as the superclass method type.
I think a simple fix would be switching the order of the arguments on ScrollBlot's optimize. I imagine this might break any consumers of ScrollBlot though.
from parchment.
A lot of other errors appear if strictNullChecks is turned on. Switching the order also does not get rid of the error as ContainerBlot's signature is only one parameter and ScrollBlot is two. I'm not seeing the practical benefits of this issue. Can you clarify what you are trying to do and how this is getting in the way?
from parchment.
Closing inactive issue.
from parchment.
There is an answer in TypeScript function overloading:
You can declare an overloaded function by declaring the function as having a type which has multiple invocation signatures
So, this might work:
optimize: {
(context: { [key: string]: any }): void;
(mutations: MutationRecord[], context: { [key: string]: any }): void;
};
from parchment.
Related Issues (20)
- block
- How cloud I understand Scope and What is the meaning of & operator between Scope and another Scope
- How to set editor content with html style
- Make v2 the default branch HOT 1
- register Blot unsucessfully
- [Question] Is it possible to define how a blot is serialized ? HOT 1
- How to add custom inline blot (or any blot whatsoever)? HOT 2
- Where can I find the old version commit? HOT 1
- Incorrect descendant typing (ts2769) HOT 1
- Adding a custom Blot HOT 1
- Remove Byte Order Mark (BOM) characters from Blot HOT 3
- Quill editor removes inline style margin-left on loading content
- the img tag is not closed HOT 1
- re-export classes from quill-delta and parchment
- How do we replicate the functionality inside a blot's `replace` function?
- Support ClassAttributor if prefix == ''
- Paste options for plain text content
- Inline Embed not working in 2.0 branch
- Is this condition of `uiNode` a typo? HOT 2
- registering a new blot does not add it to the allowed children of the scroll object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parchment.