@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Function validateSchema

    • Runs a schema synchronously and returns the typed result.

      The one place the framework calls a validator, so it is the one place that has to hold the sync-only line. The spec permits validate to return a promise, and the spec's own FAQ tells sync-only consumers to detect that and throw — which is what happens here. Without it an async validator's promise was treated as a successful result, and every read silently returned undefined while reporting success.

      Type Parameters

      • Output

      Parameters

      Returns SchemaResult<Output>

      TypeError when the schema validates asynchronously. A synchronous third-party validator exception is propagated unchanged.

      const result = validateSchema(s.number({ min: 1 }), raw);
      if ('issues' in result) throw new Error(result.issues[0]?.message);
      use(result.value);