main
|
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 20 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
416 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | Create a type with the keys of the given type changed to `string` type.
|
|---|
| 3 |
|
|---|
| 4 | Use-case: Changing interface values to strings in order to use them in a form model.
|
|---|
| 5 |
|
|---|
| 6 | @example
|
|---|
| 7 | ```
|
|---|
| 8 | import {Stringified} from 'type-fest';
|
|---|
| 9 |
|
|---|
| 10 | type Car {
|
|---|
| 11 | model: string;
|
|---|
| 12 | speed: number;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | const carForm: Stringified<Car> = {
|
|---|
| 16 | model: 'Foo',
|
|---|
| 17 | speed: '101'
|
|---|
| 18 | };
|
|---|
| 19 | ```
|
|---|
| 20 | */
|
|---|
| 21 | export type Stringified<ObjectType> = {[KeyType in keyof ObjectType]: string};
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.