Skip to content

Commit

Permalink
docs: add demo application link
Browse files Browse the repository at this point in the history
  • Loading branch information
armanozak committed Apr 21, 2019
1 parent 5f1886c commit b8dbc83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -72,15 +72,17 @@ Otherwise, you will get a type error. Using `snq`, it is safe to write the follo
```typescript
const symbol = snq(() => this.products[0].price.original.symbol);

// symbol is undefined if a type error happens
// symbol is undefined if a type error happens, actual value if not
```

There is an optional second argument which represents the default value to return when a type error happens.

```typescript
const symbol = snq(() => this.products[0].price.original.symbol, '$');

// symbol is "$" if a type error happens
// symbol is "$" if a type error happens, actual value if not
```

The type of the symbol returned will be inferred as string in both cases.

Check the [demo application](https://stackblitz.com/edit/snq) out.

0 comments on commit b8dbc83

Please sign in to comment.