Skip to content
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

Utilize the new asserts feature of TS 3.7 #26

Open
lazarljubenovic opened this issue Oct 27, 2019 · 0 comments
Open

Utilize the new asserts feature of TS 3.7 #26

lazarljubenovic opened this issue Oct 27, 2019 · 0 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@lazarljubenovic
Copy link
Owner

From here:

function assertIsString(val: any): asserts val is string {
    if (typeof val !== "string") {
        throw new AssertionError("Not a string!");
    }
}

Brainstorm todo list

  • Check if it's convenient to use the library with a simple consumer-created assert method, such as assert(tg.isString), or should type-guards provide the assert function with an easy-to-use signature with type guards provided by the library.
  • Is it needed to provide things like tg.assertIsString, or should the above assert(tg.isString) or tg.assert(tg.isString) enough?
@lazarljubenovic lazarljubenovic added enhancement New feature or request question Further information is requested labels Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant