diff --git a/modules/store/spec/types/action_group_creator.spec.ts b/modules/store/spec/types/action_group_creator.spec.ts index a21045559e..d2664843c6 100644 --- a/modules/store/spec/types/action_group_creator.spec.ts +++ b/modules/store/spec/types/action_group_creator.spec.ts @@ -60,13 +60,13 @@ describe('createActionGroup', () => { }); describe('source', () => { - it('should fail when source is not a template literal type', () => { + it('should fail when source is not a string literal type', () => { expectSnippet(` const booksApiActions = createActionGroup({ source: 'Books API' as string, events: {}, }); - `).toFail(/source must be a template literal type/); + `).toFail(/source must be a string literal type/); }); }); @@ -116,7 +116,7 @@ describe('createActionGroup', () => { ); }); - it('should fail when event name is not a template literal type', () => { + it('should fail when event name is not a string literal type', () => { expectSnippet(` const booksApiActions = createActionGroup({ source: 'Books API', @@ -124,7 +124,7 @@ describe('createActionGroup', () => { ['Load Books Success' as string]: emptyProps() }, }); - `).toFail(/event name must be a template literal type/); + `).toFail(/event name must be a string literal type/); }); describe('forbidden characters', () => { diff --git a/modules/store/src/action_group_creator_models.ts b/modules/store/src/action_group_creator_models.ts index 01b10027ec..fcc2e58435 100644 --- a/modules/store/src/action_group_creator_models.ts +++ b/modules/store/src/action_group_creator_models.ts @@ -70,10 +70,10 @@ type EmptyStringCheck< ? `${Name} cannot be an empty string or contain only spaces` : unknown; -type TemplateLiteralCheck< +type StringLiteralCheck< Str extends string, Name extends string -> = string extends Str ? `${Name} must be a template literal type` : unknown; +> = string extends Str ? `${Name} must be a string literal type` : unknown; type UniqueEventNameCheck< EventNames extends string, @@ -120,11 +120,11 @@ export interface ActionGroupConfig< Source extends string, Events extends Record | Creator> > { - source: Source & TemplateLiteralCheck; + source: Source & StringLiteralCheck; events: { [EventName in keyof Events]: Events[EventName] & EmptyStringCheck & - TemplateLiteralCheck & + StringLiteralCheck & ForbiddenCharactersCheck & UniqueEventNameCheck & NotAllowedEventPropsCheck;