Skip to content

Feat/strict class type#34

Draft
Julusian wants to merge 9 commits intonytamin:masterfrom
Julusian:feat/strict-class-type
Draft

Feat/strict class type#34
Julusian wants to merge 9 commits intonytamin:masterfrom
Julusian:feat/strict-class-type

Conversation

@Julusian
Copy link
Copy Markdown
Collaborator

Related: #20

This completely overhauls how we handle the class type. Instead of mangling the class to be 'Promisey', we instead require that the original class operates in promises. This is needed because the following class will need code changes as the callback will instead return a Promise<number> not a number

export class CallbackClass {
	async basicFcn (cb: () => number) {
		return cb() + 5
	}
}

Also by doing this, we can very clearly whitelist what datatypes are allowed to be used, and using anything else will result in type errors.

Additionally, support for property getters/setters has been removed, as they do not translate properly, and end up with the setters wanting to be given a promise, and you cant await the set so could become a floating promise.

This does make it a very breaking change, as any class not specifically designed for this will not work.

TODO

  • Remove the code which handled getters/setters
  • Review the code for other 'dead' bits (the changes so far only change the typings)
  • Fix/remove the remaining disabled tests
  • Finish implementing the EventEmitter2 in house.ts and move it to be a core type for library consumers to use

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.

1 participant