Effect CommunityEC
Effect Community2y ago
5 replies
cyberix

Issue with Template Literal Example in Documentation

I can't get the template literal example from the documentation to work. I keep getting type errors of the form.
Type 'Schema<string, string, never>' is not assignable to type 'Schema<`a${string}`, `a${string}`, never>'.
  Type 'string' is not assignable to type '`a${string}`'.ts(2322)

Here is the example code that produced that error.
import * as S from '@effect/schema/Schema'

export const Example: S.Schema<`a${string}`> = S.templateLiteral(
  S.literal('a'),
  S.string,
)

Any tips on how to fix the issue?
Was this page helpful?