Error with Schema Composition and Missing 'strict' Property in Type Definition

const s1 = Schema.transformOrFail(Schema.Array(Schema.String), Schema.String, {
  strict: true,
  decode: (a, _, ast) =>
    Effect.gen(function* () {
      if (a.length !== 2 || a[0] !== 'Bearer') {
        throw ParseResult.fail(new ParseResult.Type(ast, a, 'Invalid Authorization header'));
      }
      return a[1];
    }),
  encode: (s) => Effect.succeed([s]),
});

const s = Schema.compose(Schema.split(' '), s1, Schema.StringFromBase64);


Property 'strict' is missing in type 'Schema<string, string, never>' but required in type '{ readonly strict: false; }'.

I do not understand this error. Once s1 has completed decoding, it should be a string right? Then Schema.StringFromBase64 takes in a base64 String and decodes it.

My plan is to parse a base64 encoded Bearer AuthToken
Was this page helpful?