-
Notifications
You must be signed in to change notification settings - Fork 7
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
ES6 classes and Advanced Typings #13
base: master
Are you sure you want to change the base?
Conversation
Thanks for your interest in contributing! Wow, this completely rewrites the package. I'm not opposed to accepting, but there is a laundry list of changes I'd like to see before doing so 🙂 Overall questions/comments:
Then there are some inline comments. |
Interest came from idea of callable objects in JS. I decided to change implementation because of setPrototypeOf https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf. |
Everything in
Got it. An example would be very useful in the README.
This change will be a new major version, so we can have a note that says that ES5-compatible implementation lives in Checks look good, please run Prettier on the source files and update the README as you wanted to. I'll proofread the README and then we can publish this as version 3.0.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently adding my top-level comment left all these in pending, apologies.
Will be finished. just dont have time now. I will comment when module is ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, apologies for the delay on this. I reviewed the library code and it all looks great, with just a few minor inlines.
I will review the tests as well ASAP. Don't worry about making the inline changes; I can do that when I review the tests. If the tests look good, I will go ahead and merge into main and release the version to NPM.
How would you like to be credited in the README?
.gitignore
Outdated
@@ -36,4 +36,5 @@ jspm_packages | |||
# Optional REPL history | |||
.node_repl_history | |||
|
|||
/dist | |||
# dist | |||
dist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this was a meaningful change, either remove it or remove the useless comment.
lib/index.d.ts
Outdated
@@ -0,0 +1,78 @@ | |||
declare module "callable-instance" { | |||
const CALL: unique symbol; | |||
export type SCALL = typeof CALL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove this type alias. It's not saving much and it adds an extra concept for people to be confused by. In this file we can use typeof CALL
directly, and any consumer can use typeof Callable.CALL
.
"types": "index.d.ts", | ||
"main": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"type": "commonjs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add sideEffects: false
to this.
test/classGeneric.ts
Outdated
// expectType<Function>(new RepeaterWithTSClassOverride(5)); | ||
// expectType<Object>(new RepeaterWithTSClassOverride(5)); | ||
// }); | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove dead code
Hello, also apologies for the delay. I recently found out that CSP blocks Function constructor. UPD: Simplified code with new.target.prototype. Basically I combined the bind and prototype way from medium article. So now it must be both performant and CSP friendly. (Prototype is set only once and bind is used for prototyped function cloning) Readme is not that necessary for me but you can add me to contributors/collaborators if you want. |
Hello. I decided to remake implementation of your callable-instance. (Switched to ES6 class syntax and ES6 Symbols).
If you don`t mind Accepting my pull request, let me know first so I can create Readme.