-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
taskTaskTask
Description
For example, add runtime type guards on the Transaction constructor. Throw errors if type constraints aren't satisfied. This might not be in tone with TypeScript's philosophy, but it's important in practice, to aid debugging.
Today we had a quite long debugging session around a snippet such as:
// Receive a plain transaction object from a source
const input: any = { ... }
// Incorrect, with bugs, but no compile time & runtime errors
const transaction = new Transaction(input);
// Correct (but suboptimal design):
const transaction = Transaction.fromPlainObject(input);
Impact on existing code: we should strive to have only fixing changes - and avoid breaking changes on this topic.
michavie
Metadata
Metadata
Assignees
Labels
taskTaskTask