@@ -2,6 +2,8 @@ import {expectType} from 'tsd';
22import type { PascalCasedProperties } from '../index.d.ts' ;
33
44declare const foo : PascalCasedProperties < { helloWorld : { fooBar : string } } > ;
5+ type FoobarPunctuated = { 'hello@World1' : { 'foo::Bar' : string } } ;
6+
57expectType < { HelloWorld : { fooBar : string } } > ( foo ) ;
68
79declare const bar : PascalCasedProperties < Array < { helloWorld : string } > > ;
@@ -10,16 +12,32 @@ expectType<Array<{helloWorld: string}>>(bar);
1012declare const fooBar : PascalCasedProperties < ( ) => { a : string } > ;
1113expectType < ( ) => { a : string } > ( fooBar ) ;
1214
15+ declare const fooBarPunctuated : PascalCasedProperties < FoobarPunctuated > ;
16+ expectType < { 'Hello@World1' : { 'foo::Bar' : string } } > ( fooBarPunctuated ) ;
17+
18+ declare const fooBarPunctuatedSplit : PascalCasedProperties < FoobarPunctuated , { splitOnPunctuation : true } > ;
19+ expectType < { 'HelloWorld1' : { 'foo::Bar' : string } } > ( fooBarPunctuatedSplit ) ;
20+
21+ declare const fooBarPunctuatedSplitNumberSplit : PascalCasedProperties < FoobarPunctuated , { splitOnPunctuation : true ; splitOnNumbers : true } > ;
22+ expectType < { 'HelloWorld1' : { 'foo::Bar' : string } } > ( fooBarPunctuatedSplitNumberSplit ) ;
23+
1324// Verify example
1425type User = {
1526 userId : number ;
1627 userName : string ;
1728} ;
29+
30+ type UserPunctuated = {
31+ 'user::id' : number ;
32+ 'user::name' : string ;
33+ } ;
34+
1835const result : PascalCasedProperties < User > = {
1936 UserId : 1 ,
2037 UserName : 'Tom' ,
2138} ;
2239expectType < PascalCasedProperties < User > > ( result ) ;
40+ expectType < PascalCasedProperties < UserPunctuated , { splitOnPunctuation : true } > > ( result ) ;
2341
2442declare const baz : PascalCasedProperties < { fooBAR : number ; BARFoo : string } , { preserveConsecutiveUppercase : true } > ;
2543expectType < { FooBAR : number ; BARFoo : string } > ( baz ) ;
0 commit comments