elierotenberg / elierotenberg/typed-assert

How to assert for notNullish? for not empty string?

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
53
Forks
3
PR merge metrics
No merged PRs in 30d

Description

1) How to assert for notNullish?

`data != null`

I mean, I understand it can be done as:
```ts
t.NotNull(data)
t.NotUndefined(data)
```

But that is too much typing. Two lines of code for what can be done in a single `if`.

2) How to assert for not empty string?

`str != null && str != ''`

I cannot find it among the available functions.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing NotNull and NotUndefined assertions and reviewing the library's available assertion functions. Determine how the requested not-nullish and non-empty-string assertions should fit the public API; done means both cases can be asserted with concise, typesafe calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.