Skip to content

Commit

Permalink
Split the code blocks in README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
oshx committed Jul 3, 2024
1 parent 9a58fd8 commit caf18be
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ Please add below in `tsconfig.json` file.

```typescript
type ObjectKey
// explicit constant object keys
// explicit constant object keys
```

```typescript
type ObjectValue
// explicit constant object values
// explicit constant object values
```

```typescript
type PropsWithClassName
// extendable interface-like-type with optional property 'className'
// extendable interface-like-type with optional property 'className'
```

```typescript
type AnyFunction
// simply declared any function
// simply declared any function
```

## Why it comes for?
Expand Down Expand Up @@ -78,6 +84,7 @@ export const ObjectA = {
KEY_A: 'valueA',
KEY_B: 'valueB',
} as const;
// Same effects with Enum type!
export type ObjectAKey = ObjectKey<typeof ObjectA>;
export type ObjectAValue = ObjectValue<typeof ObjectA>;
Expand All @@ -86,7 +93,7 @@ export type ObjectAValue = ObjectValue<typeof ObjectA>;
const shouldBeKeyOfA: ObjectAKey = 'KeyA';
const shouldBeValueOfA: ObjectAValue = 'ValueA';
// Passed!
// Passed ✔️
const keyOfA: ObjectAKey = 'KEY_A';
const valueOfA: ObjectAValue = 'valueA';
```
Expand Down

0 comments on commit caf18be

Please sign in to comment.