source: trip-planner-front/node_modules/type-fest/ts41/pascal-case.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 608 bytes
Line 
1import {CamelCase} from './camel-case';
2
3/**
4Converts a string literal to pascal-case.
5
6@example
7```
8import {PascalCase} from 'type-fest';
9
10// Simple
11
12const someVariable: PascalCase<'foo-bar'> = 'FooBar';
13
14// Advanced
15
16type PascalCaseProps<T> = {
17 [K in keyof T as PascalCase<K>]: T[K]
18};
19
20interface RawOptions {
21 'dry-run': boolean;
22 'full_family_name': string;
23 foo: number;
24}
25
26const dbResult: CamelCasedProps<ModelProps> = {
27 DryRun: true,
28 FullFamilyName: 'bar.js',
29 Foo: 123
30};
31```
32*/
33
34export type PascalCase<Value> = CamelCase<Value> extends string
35 ? Capitalize<CamelCase<Value>>
36 : CamelCase<Value>;
Note: See TracBrowser for help on using the repository browser.