@effect-app/vue-components 4.0.0-beta.190 → 4.0.0-beta.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,4 +17,4 @@ export { default as OmegaTaggedUnion } from "./OmegaTaggedUnion.vue";
17
17
  export { default as OmegaTaggedUnionInternal } from "./OmegaTaggedUnionInternal.vue";
18
18
  export { useOnClose, usePreventClose } from "./blockDialog";
19
19
  export { createUseFormWithCustomInput } from "./createUseFormWithCustomInput";
20
- export declare const duplicateSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never, never>;
20
+ export declare const duplicateSchema: <From, To>(schema: S.Codec<To, From>) => S.Codec<To, From, never, never>;
@@ -2,7 +2,7 @@ import { type Effect, S } from "effect-app";
2
2
  import type { FieldMeta, MetaRecord } from "./types";
3
3
  export type FilterItems = {
4
4
  items: readonly [string, ...string[]];
5
- message: string | Effect.Effect<string, never, never> | {
5
+ message: string | Effect.Effect<string> | {
6
6
  readonly message: string | Effect.Effect<string>;
7
7
  };
8
8
  };
@@ -20,13 +20,13 @@ export type CreateMeta = {
20
20
  export declare const unwrapDeclaration: (property: S.AST.AST) => S.AST.AST;
21
21
  export declare const isNullableOrUndefined: (property: false | S.AST.AST | undefined) => false | "undefined" | "null";
22
22
  export declare const createMeta: <T = any>({ meta, parent, property, propertySignatures }: CreateMeta, acc?: Partial<MetaRecord<T>>) => MetaRecord<T> | FieldMeta;
23
- export declare const metadataFromAst: <From, To>(schema: S.Codec<To, From, never>) => {
23
+ export declare const metadataFromAst: <From, To>(schema: S.Codec<To, From>) => {
24
24
  meta: MetaRecord<To>;
25
25
  defaultValues: Record<string, any>;
26
26
  unionMeta: Record<string, MetaRecord<To>>;
27
27
  };
28
- export declare const generateMetaFromSchema: <From, To>(schema: S.Codec<To, From, never>) => {
29
- schema: S.Codec<To, From, never>;
28
+ export declare const generateMetaFromSchema: <From, To>(schema: S.Codec<To, From>) => {
29
+ schema: S.Codec<To, From>;
30
30
  meta: MetaRecord<To>;
31
31
  unionMeta: Record<string, MetaRecord<To>>;
32
32
  };
@@ -1,2 +1,2 @@
1
1
  import { S } from "effect-app";
2
- export declare const toFormSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never>;
2
+ export declare const toFormSchema: <From, To>(schema: S.Codec<To, From>) => S.Codec<To, From>;
@@ -41,7 +41,7 @@ export interface UsePersistencyOptions<From> {
41
41
  };
42
42
  }
43
43
  export interface UsePersistencyReturn {
44
- defaultValues: ComputedRef<any>;
44
+ defaultValues: ComputedRef;
45
45
  persistencyKey: ComputedRef<string>;
46
46
  persistData: () => void;
47
47
  saveDataInUrl: () => void;
@@ -22,8 +22,8 @@ export type UserOnSubmit<From, To> = (props: {
22
22
  formApi: OmegaFormParams<From, To>;
23
23
  meta: any;
24
24
  value: To;
25
- }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any, never>;
26
- export type RunPromise = <A, E>(eff: Effect.Effect<A, E, never>) => Promise<A>;
25
+ }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any>;
26
+ export type RunPromise = <A, E>(eff: Effect.Effect<A, E>) => Promise<A>;
27
27
  /**
28
28
  * Wraps the user's `onSubmit` to:
29
29
  * - run inside the OpenTelemetry span passed via `meta.currentSpan`
@@ -33,7 +33,7 @@ export type RunPromise = <A, E>(eff: Effect.Effect<A, E, never>) => Promise<A>;
33
33
  * Returns `undefined` when `userOnSubmit` is `undefined` (so callers can pass it
34
34
  * directly to `useForm({ onSubmit })` without changing semantics).
35
35
  */
36
- export declare const wrapOnSubmit: <From, To>(userOnSubmit: UserOnSubmit<From, To> | undefined, decode: (value: From) => Effect.Effect<To, any, never>, runPromise: RunPromise) => (({ formApi, meta, value }: {
36
+ export declare const wrapOnSubmit: <From, To>(userOnSubmit: UserOnSubmit<From, To> | undefined, decode: (value: From) => Effect.Effect<To, any>, runPromise: RunPromise) => (({ formApi, meta, value }: {
37
37
  formApi: OmegaFormParams<From, To>;
38
38
  meta: any;
39
39
  value: From;
@@ -9,7 +9,7 @@ import type { MetaRecord, NestedKeyOf } from "./meta/types";
9
9
  import type { defaultValuesPriorityUnion as PersistencyPriority, Policies as PersistencyPolicies } from "./persistency";
10
10
  import type { FormErrors } from "./submit";
11
11
  export type FieldPath<T> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? "" : T extends ReadonlyArray<infer U> ? FieldPath_<U, `[${number}]`> : {
12
- [K in keyof T]: FieldPath_<T[K], `${K & string}`>;
12
+ [K in keyof T]: FieldPath_<T[K], K & string>;
13
13
  }[keyof T];
14
14
  export type FieldPath_<T, Path extends string> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? Path : T extends ReadonlyArray<infer U> ? FieldPath_<U, `${Path}[${number}]`> | Path : {
15
15
  [K in keyof T]: FieldPath_<T[K], `${Path}.${K & string}`>;
@@ -71,7 +71,7 @@ export type FormProps<From, To> = Omit<FormOptions<From, FormValidateOrFn<From>
71
71
  formApi: OmegaFormParams<From, To>;
72
72
  meta: any;
73
73
  value: To;
74
- }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any, never>;
74
+ }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any>;
75
75
  };
76
76
  export type OmegaFormParams<From, To> = FormApi<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, Record<string, any> | undefined>;
77
77
  export type OmegaFormState<From, To> = FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
@@ -162,7 +162,7 @@ type CachedFieldState<From extends Record<PropertyKey, any>, To extends Record<P
162
162
  export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps> extends OF<From, To> {
163
163
  _paths: FieldPath<From>;
164
164
  _keys: NestedKeyOf<From>;
165
- _schema: S.Codec<To, From, never>;
165
+ _schema: S.Codec<To, From>;
166
166
  Input: <Name extends OmegaFormReturn<From, To, TypeProps>["_paths"]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
167
167
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & TypeProps & Partial<{}>> & BaseProps<From, Name> & PublicProps;
168
168
  expose(exposed: ShallowUnwrapRef<{}>): void;
@@ -5,4 +5,4 @@ export { useErrorLabel } from "./errors";
5
5
  export { FormErrors } from "./submit";
6
6
  export type { defaultValuesPriorityUnion, OF, OmegaConfig, OmegaFormReturn, Policies } from "./types";
7
7
  export declare const OmegaFormKey: InjectionKey<OF<any, any>>;
8
- export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps>(schema: S.Codec<To, From, never>, tanstackFormOptions?: NoInfer<FormProps<From, To>>, omegaConfig?: OmegaConfig<To>) => OmegaFormReturn<From, To, TypeProps>;
8
+ export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps>(schema: S.Codec<To, From>, tanstackFormOptions?: NoInfer<FormProps<From, To>>, omegaConfig?: OmegaConfig<To>) => OmegaFormReturn<From, To, TypeProps>;
@@ -6,5 +6,5 @@ export declare const makeStandardSchemaV1Hooks: (trans: TransFn) => {
6
6
  leafHook: S.SchemaIssue.LeafHook;
7
7
  checkHook: S.SchemaIssue.CheckHook;
8
8
  };
9
- export declare const toLocalizedStandardSchemaV1: <To, From>(schema: S.Codec<To, From, never, never>, trans: TransFn) => StandardSchemaV1<From, To>;
10
- export declare const annotateLiteralUnionMessages: <To, From>(schema: S.Codec<To, From, never, never>, trans: TransFn) => S.Codec<To, From, never, never>;
9
+ export declare const toLocalizedStandardSchemaV1: <To, From>(schema: S.Codec<To, From>, trans: TransFn) => StandardSchemaV1<From, To>;
10
+ export declare const annotateLiteralUnionMessages: <To, From>(schema: S.Codec<To, From>, trans: TransFn) => S.Codec<To, From>;
@@ -23,7 +23,7 @@ var i = (e) => r.AST.isUndefined(e) || r.AST.isNull(e), a = (e) => r.AST.isUnion
23
23
  }, c = (e, n, r, i) => {
24
24
  for (let a of e) {
25
25
  let e = n ? `${n}.${a.name.toString()}` : a.name.toString(), o = t(a.type), s = a.type.context?.isOptional === !0, c;
26
- c = r.isNullableDiscriminatedUnion && a.name.toString() === "_tag" || r.required === !1 || s ? !1 : !o, u(a.type, e, {
26
+ c = r.isNullableDiscriminatedUnion && a.name.toString() === "_tag" ? !1 : r.required ? s ? !1 : !o : !1, u(a.type, e, {
27
27
  required: c,
28
28
  nullableOrUndefined: o,
29
29
  isOptionalKey: s
@@ -77,23 +77,24 @@ var i = (e) => r.AST.isUndefined(e) || r.AST.isNull(e), a = (e) => r.AST.isUnion
77
77
  }
78
78
  return;
79
79
  }
80
- if (m.some(r.AST.isArrays)) {
81
- u(m.find(r.AST.isArrays), t, l, d);
80
+ let h = m.find(r.AST.isArrays);
81
+ if (h) {
82
+ u(h, t, l, d);
82
83
  return;
83
84
  }
84
- let h = p.map(a);
85
- if (h.every((e) => i(e) || r.AST.isLiteral(e))) {
85
+ let g = p.map(a);
86
+ if (g.every((e) => i(e) || r.AST.isLiteral(e))) {
86
87
  let { isOptionalKey: e, nullableOrUndefined: n, required: i } = l, a = {
87
88
  required: i,
88
89
  nullableOrUndefined: n,
89
90
  type: "select",
90
- members: h.filter(r.AST.isLiteral).map((e) => e.literal)
91
+ members: g.filter(r.AST.isLiteral).map((e) => e.literal)
91
92
  };
92
93
  e && (a.isOptionalKey = !0), f[t] = a;
93
94
  return;
94
95
  }
95
- let g = m[0];
96
- g && u(g, t, l, d);
96
+ let _ = m[0];
97
+ _ && u(_, t, l, d);
97
98
  }, u = (t, i, a, o) => {
98
99
  t = n(t);
99
100
  let { acc: u } = o;
@@ -18,7 +18,7 @@ var s = class extends r.TaggedError("FormErrors") {}, c = (n, r) => n ? e.with(t
18
18
  return c;
19
19
  });
20
20
  }, u = (n) => {
21
- let r = n.handleSubmit, a = async (e) => await r(e), c = (n) => a({
21
+ let r = n.handleSubmit.bind(n), a = async (e) => await r(e), c = (n) => a({
22
22
  currentSpan: t.getSpan(e.active()),
23
23
  ...n
24
24
  }), l = (e) => i.currentSpan.pipe(i.option, i.flatMap((t) => i.promise(() => a(o.isSome(t) ? {
@@ -27,8 +27,8 @@ var a = () => e(), o = Symbol("DialogBus"), s = () => r(o, null), c = () => {
27
27
  return t ||= c(), () => {
28
28
  let n = {};
29
29
  t.emit("dialog-closing", n), n.prevent ? typeof n.prevent == "object" && "then" in n.prevent && n.prevent.then((t) => {
30
- t !== !1 && e();
31
- }) : e();
30
+ t && e();
31
+ }).catch(console.error) : e();
32
32
  };
33
33
  };
34
34
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "4.0.0-beta.190",
3
+ "version": "4.0.0-beta.191",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "effect": "^4.0.0-beta.60",
@@ -33,7 +33,7 @@
33
33
  "vue-toastification": "^2.0.0-rc.5",
34
34
  "vue-tsc": "^3.2.7",
35
35
  "vuetify": "^4.0.6",
36
- "@effect-app/eslint-shared-config": "0.6.0-beta.18"
36
+ "@effect-app/eslint-shared-config": "0.6.0-beta.19"
37
37
  },
38
38
  "files": [
39
39
  "src",
@@ -57,8 +57,8 @@
57
57
  "highlight.js": "^11.11.1",
58
58
  "mitt": "^3.0.1",
59
59
  "vue3-highlightjs": "^1.0.5",
60
- "effect-app": "4.0.0-beta.190",
61
- "@effect-app/vue": "4.0.0-beta.190"
60
+ "@effect-app/vue": "4.0.0-beta.191",
61
+ "effect-app": "4.0.0-beta.191"
62
62
  },
63
63
  "scripts": {
64
64
  "check": "vue-tsc",
@@ -67,10 +67,10 @@
67
67
  "docs:dev": "vitepress dev docs",
68
68
  "docs:build": "vitepress build docs",
69
69
  "docs:serve": "vitepress serve docs",
70
- "lint": "oxlint src stories && NODE_OPTIONS=--max-old-space-size=8192 eslint src stories .storybook && pnpm exec dprint check --config ../../dprint.jsonc .",
70
+ "lint": "oxlint --quiet --type-aware src stories && NODE_OPTIONS=--max-old-space-size=8192 ESLINT_TS=1 eslint --quiet src stories .storybook && pnpm exec dprint check --config ../../dprint.jsonc .",
71
71
  "ncu": "ncu",
72
72
  "clean": "rm -rf dist",
73
- "lint-fix": "oxlint --fix src stories && NODE_OPTIONS=--max-old-space-size=8192 eslint --fix src stories .storybook && pnpm exec dprint fmt --config ../../dprint.jsonc .",
73
+ "lint-fix": "oxlint --quiet --type-aware --fix src stories && NODE_OPTIONS=--max-old-space-size=8192 ESLINT_TS=1 eslint --quiet --fix src stories .storybook && pnpm exec dprint fmt --config ../../dprint.jsonc .",
74
74
  "storybook": "storybook dev -p 6006",
75
75
  "build-storybook": "storybook build",
76
76
  "test": "vitest",
@@ -38,7 +38,7 @@ watch(() => props.state, (newTag, oldTag) => {
38
38
  if (newTag !== oldTag) {
39
39
  props.form.reset(values.value)
40
40
  setTimeout(() => {
41
- props.field.validate("change")
41
+ void props.field.validate("change")
42
42
  }, 0)
43
43
  }
44
44
  }, { immediate: true })
@@ -55,11 +55,14 @@ export const useOnClose = (close: () => void) => {
55
55
  bus.emit("dialog-closing", evt)
56
56
  if (evt.prevent) {
57
57
  if (typeof evt.prevent === "object" && "then" in evt.prevent) {
58
- evt.prevent.then((r) => {
59
- if (r !== false) {
60
- close()
61
- }
62
- })
58
+ evt
59
+ .prevent
60
+ .then((r) => {
61
+ if (r) {
62
+ close()
63
+ }
64
+ })
65
+ .catch(console.error)
63
66
  }
64
67
  } else {
65
68
  close()
@@ -110,7 +110,7 @@ export const eHoc = (errorProps: {
110
110
  errors,
111
111
  generalErrors,
112
112
  ...this.$attrs
113
- } as any, this.$slots)
113
+ }, this.$slots)
114
114
  }
115
115
  }
116
116
  }
@@ -12,7 +12,7 @@ export const fHoc = (form: OF<any, any>) => {
12
12
  return h(WrappedComponent, {
13
13
  form,
14
14
  ...this.$attrs
15
- } as any, this.$slots)
15
+ }, this.$slots)
16
16
  }
17
17
  }
18
18
  }
@@ -23,4 +23,4 @@ export { useOnClose, usePreventClose } from "./blockDialog"
23
23
 
24
24
  export { createUseFormWithCustomInput } from "./createUseFormWithCustomInput"
25
25
 
26
- export const duplicateSchema = <From, To>(schema: S.Codec<To, From, never>) => schema
26
+ export const duplicateSchema = <From, To>(schema: S.Codec<To, From>) => schema
@@ -8,7 +8,7 @@ export type FilterItems = {
8
8
  items: readonly [string, ...string[]]
9
9
  message:
10
10
  | string
11
- | Effect.Effect<string, never, never>
11
+ | Effect.Effect<string>
12
12
  | { readonly message: string | Effect.Effect<string> }
13
13
  }
14
14
 
@@ -33,7 +33,7 @@ export const unwrapDeclaration = (property: S.AST.AST): S.AST.AST => {
33
33
  let current = getTransformationFrom(property)
34
34
 
35
35
  while (S.AST.isDeclaration(current) && current.typeParameters.length > 0) {
36
- current = getTransformationFrom(current.typeParameters[0]!)
36
+ current = getTransformationFrom(current.typeParameters[0])
37
37
  }
38
38
 
39
39
  return current
@@ -96,7 +96,7 @@ export const createMeta = <T = any>(
96
96
  }
97
97
 
98
98
  export const metadataFromAst = <From, To>(
99
- schema: S.Codec<To, From, never>
99
+ schema: S.Codec<To, From>
100
100
  ): {
101
101
  meta: MetaRecord<To>
102
102
  defaultValues: Record<string, any>
@@ -126,9 +126,9 @@ export const metadataFromAst = <From, To>(
126
126
  }
127
127
 
128
128
  export const generateMetaFromSchema = <From, To>(
129
- schema: S.Codec<To, From, never>
129
+ schema: S.Codec<To, From>
130
130
  ): {
131
- schema: S.Codec<To, From, never>
131
+ schema: S.Codec<To, From>
132
132
  meta: MetaRecord<To>
133
133
  unionMeta: Record<string, MetaRecord<To>>
134
134
  } => {
@@ -102,7 +102,7 @@ export const defaultsValueFromSchema = (
102
102
  for (const prop of memberAst.propertySignatures) {
103
103
  const key = prop.name.toString()
104
104
  const fieldDefault = getDefaultFromAst(prop.type)
105
- const existingDefault = mergedFields[key] ? getDefaultFromAst(mergedFields[key]!.ast) : undefined
105
+ const existingDefault = mergedFields[key] ? getDefaultFromAst(mergedFields[key].ast) : undefined
106
106
 
107
107
  if (!mergedFields[key] || (fieldDefault !== undefined && existingDefault === undefined)) {
108
108
  mergedFields[key] = { ast: prop.type }
@@ -19,8 +19,8 @@ const isRedactedWithoutEncoding = (ast: S.AST.AST): boolean =>
19
19
  * plain values on the encoded side and wraps them in Redacted on decode.
20
20
  */
21
21
  export const toFormSchema = <From, To>(
22
- schema: S.Codec<To, From, never>
23
- ): S.Codec<To, From, never> => {
22
+ schema: S.Codec<To, From>
23
+ ): S.Codec<To, From> => {
24
24
  const ast = schema.ast
25
25
  const objAst = S.AST.isObjects(ast)
26
26
  ? ast
@@ -36,14 +36,14 @@ export const toFormSchema = <From, To>(
36
36
  for (const p of objAst.propertySignatures) {
37
37
  if (isRedactedWithoutEncoding(p.type)) {
38
38
  hasRedacted = true
39
- const innerSchema = S.make((p.type as S.AST.Declaration).typeParameters[0]!)
39
+ const innerSchema = S.make((p.type as S.AST.Declaration).typeParameters[0])
40
40
  props[p.name as string] = S.RedactedFromValue(innerSchema)
41
41
  } else if (S.AST.isUnion(p.type)) {
42
42
  const types = p.type.types
43
43
  const redactedType = types.find(isRedactedWithoutEncoding)
44
44
  if (redactedType) {
45
45
  hasRedacted = true
46
- const innerSchema = S.make((redactedType as S.AST.Declaration).typeParameters[0]!)
46
+ const innerSchema = S.make((redactedType as S.AST.Declaration).typeParameters[0])
47
47
  const hasNull = types.some(S.AST.isNull)
48
48
  const hasUndefined = types.some(S.AST.isUndefined)
49
49
  const base = S.RedactedFromValue(innerSchema)
@@ -62,5 +62,5 @@ export const toFormSchema = <From, To>(
62
62
  }
63
63
  }
64
64
 
65
- return hasRedacted ? S.Struct(props) as unknown as S.Codec<To, From, never> : schema
65
+ return hasRedacted ? S.Struct(props) as unknown as S.Codec<To, From> : schema
66
66
  }
@@ -9,8 +9,8 @@ const isNullishType = (property: S.AST.AST) => S.AST.isUndefined(property) || S.
9
9
 
10
10
  // TODO: remove after manual _tag deprecation — S.Struct({ _tag: S.Literal("X") }) wraps as Union([Literal("X")])
11
11
  const unwrapSingleLiteralUnion = (ast: S.AST.AST): S.AST.AST =>
12
- S.AST.isUnion(ast) && ast.types.length === 1 && S.AST.isLiteral(ast.types[0]!)
13
- ? ast.types[0]!
12
+ S.AST.isUnion(ast) && ast.types.length === 1 && S.AST.isLiteral(ast.types[0])
13
+ ? ast.types[0]
14
14
  : ast
15
15
 
16
16
  const unwrapNestedUnions = (types: readonly S.AST.AST[]): readonly S.AST.AST[] =>
@@ -76,7 +76,7 @@ export const walkStruct = <T>(
76
76
  let isRequired: boolean
77
77
  if (parentMeta.isNullableDiscriminatedUnion && p.name.toString() === "_tag") {
78
78
  isRequired = false
79
- } else if (parentMeta.required === false) {
79
+ } else if (!parentMeta.required) {
80
80
  isRequired = false
81
81
  } else if (isOptionalKey) {
82
82
  isRequired = false
@@ -104,8 +104,8 @@ export const classifyAndWalkUnion = <T>(
104
104
  const nonNullTypes = unwrappedTypes.filter((t) => !isNullishType(t))
105
105
 
106
106
  // Boolean literal shortcut (single-value union wrapping a boolean literal)
107
- if (nonNullTypes.length === 1 && S.AST.isLiteral(nonNullTypes[0]!) && typeof nonNullTypes[0]!.literal === "boolean") {
108
- acc[key as NestedKeyOf<T>] = leafMetaForAst(nonNullTypes[0]!, parentMeta)
107
+ if (nonNullTypes.length === 1 && S.AST.isLiteral(nonNullTypes[0]) && typeof nonNullTypes[0].literal === "boolean") {
108
+ acc[key as NestedKeyOf<T>] = leafMetaForAst(nonNullTypes[0], parentMeta)
109
109
  return
110
110
  }
111
111
 
@@ -147,7 +147,7 @@ export const classifyAndWalkUnion = <T>(
147
147
  }
148
148
 
149
149
  for (const [metaKey, metaValue] of Object.entries(branchCtx.acc)) {
150
- const existing = acc[metaKey as NestedKeyOf<T>] as FieldMeta | undefined
150
+ const existing = acc[metaKey as NestedKeyOf<T>]
151
151
  if (existing && existing.type === "select" && (metaValue as any)?.type === "select") {
152
152
  existing.members = [
153
153
  ...existing.members,
@@ -161,7 +161,7 @@ export const classifyAndWalkUnion = <T>(
161
161
 
162
162
  if (discriminatorValues.length > 0) {
163
163
  const tagKey = key ? `${key}._tag` : "_tag"
164
- const existing = acc[tagKey as NestedKeyOf<T>] as FieldMeta | undefined
164
+ const existing = acc[tagKey as NestedKeyOf<T>]
165
165
  if (existing && existing.type === "select") {
166
166
  for (const v of discriminatorValues) {
167
167
  if (!existing.members.includes(v)) existing.members.push(v)
@@ -177,8 +177,9 @@ export const classifyAndWalkUnion = <T>(
177
177
  return
178
178
  }
179
179
 
180
- if (nonNullTypes.some(S.AST.isArrays)) {
181
- walk(nonNullTypes.find(S.AST.isArrays)!, key, parentMeta, ctx)
180
+ const ast = nonNullTypes.find(S.AST.isArrays)
181
+ if (ast) {
182
+ walk(ast, key, parentMeta, ctx)
182
183
  return
183
184
  }
184
185
 
@@ -222,7 +223,7 @@ export const walk = <T>(
222
223
  }
223
224
 
224
225
  if (S.AST.isArrays(ast)) {
225
- const restElement = ast.rest.length > 0 ? unwrapDeclaration(ast.rest[0]!) : null
226
+ const restElement = ast.rest.length > 0 ? unwrapDeclaration(ast.rest[0]) : null
226
227
  if (restElement && S.AST.isObjects(restElement)) {
227
228
  // Array-of-struct: skip creating a meta entry for the array itself,
228
229
  // recurse into the element struct's properties instead
@@ -62,7 +62,7 @@ export interface UsePersistencyOptions<From> {
62
62
  }
63
63
 
64
64
  export interface UsePersistencyReturn {
65
- defaultValues: ComputedRef<any>
65
+ defaultValues: ComputedRef
66
66
  persistencyKey: ComputedRef<string>
67
67
  persistData: () => void
68
68
  saveDataInUrl: () => void
@@ -38,9 +38,9 @@ export type UserOnSubmit<From, To> = (props: {
38
38
  formApi: OmegaFormParams<From, To>
39
39
  meta: any
40
40
  value: To
41
- }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any, never>
41
+ }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any>
42
42
 
43
- export type RunPromise = <A, E>(eff: Effect.Effect<A, E, never>) => Promise<A>
43
+ export type RunPromise = <A, E>(eff: Effect.Effect<A, E>) => Promise<A>
44
44
 
45
45
  /**
46
46
  * Wraps the user's `onSubmit` to:
@@ -53,7 +53,7 @@ export type RunPromise = <A, E>(eff: Effect.Effect<A, E, never>) => Promise<A>
53
53
  */
54
54
  export const wrapOnSubmit = <From, To>(
55
55
  userOnSubmit: UserOnSubmit<From, To> | undefined,
56
- decode: (value: From) => Effect.Effect<To, any, never>,
56
+ decode: (value: From) => Effect.Effect<To, any>,
57
57
  runPromise: RunPromise
58
58
  ) => {
59
59
  if (!userOnSubmit) return undefined
@@ -89,7 +89,7 @@ export const wrapOnSubmit = <From, To>(
89
89
  export const makeSubmitHandlers = <From, To>(
90
90
  form: OmegaFormApi<From, To>
91
91
  ) => {
92
- const hs = form.handleSubmit
92
+ const hs = form.handleSubmit.bind(form)
93
93
 
94
94
  const handleSubmitInner: typeof form.handleSubmit = async (meta?: Record<string, any>) => {
95
95
  return await hs(meta)
@@ -16,7 +16,7 @@ export type FieldPath<T> = unknown extends T ? string
16
16
  // technically we cannot have array at the root
17
17
  : T extends ReadonlyArray<infer U> ? FieldPath_<U, `[${number}]`>
18
18
  : {
19
- [K in keyof T]: FieldPath_<T[K], `${K & string}`>
19
+ [K in keyof T]: FieldPath_<T[K], K & string>
20
20
  }[keyof T]
21
21
 
22
22
  export type FieldPath_<T, Path extends string> = unknown extends T ? string
@@ -147,7 +147,7 @@ export type FormProps<From, To> =
147
147
  formApi: OmegaFormParams<From, To>
148
148
  meta: any
149
149
  value: To
150
- }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any, never>
150
+ }) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any>
151
151
  }
152
152
 
153
153
  export type OmegaFormParams<From, To> = FormApi<
@@ -478,7 +478,7 @@ export interface OmegaFormReturn<
478
478
  // Pre-computed type aliases - computed ONCE for performance
479
479
  _paths: FieldPath<From>
480
480
  _keys: NestedKeyOf<From>
481
- _schema: S.Codec<To, From, never>
481
+ _schema: S.Codec<To, From>
482
482
 
483
483
  // this crazy thing here is copied from the OmegaFormInput.vue.d.ts, with `From` removed as Generic, instead closed over from the From generic above..
484
484
  Input: <Name extends OmegaFormReturn<From, To, TypeProps>["_paths"]>(
@@ -38,7 +38,7 @@ export const useOmegaForm = <
38
38
  To extends Record<PropertyKey, any>,
39
39
  TypeProps = DefaultTypeProps
40
40
  >(
41
- schema: S.Codec<To, From, never>,
41
+ schema: S.Codec<To, From>,
42
42
  tanstackFormOptions?: NoInfer<FormProps<From, To>>,
43
43
  omegaConfig?: OmegaConfig<To>
44
44
  ): OmegaFormReturn<From, To, TypeProps> => {
@@ -95,7 +95,7 @@ export const useOmegaForm = <
95
95
  ...tanstackFormOptions?.validators
96
96
  },
97
97
  onSubmit: wrapOnSubmit<From, To>(tanstackFormOptions?.onSubmit, decode, runPromise),
98
- defaultValues: persistency.defaultValues.value as any
98
+ defaultValues: persistency.defaultValues.value
99
99
  }) satisfies OmegaFormApi<To, From>
100
100
  formHolder.form = form
101
101
 
@@ -92,7 +92,7 @@ export const makeStandardSchemaV1Hooks = (
92
92
  }
93
93
 
94
94
  export const toLocalizedStandardSchemaV1 = <To, From>(
95
- schema: S.Codec<To, From, never, never>,
95
+ schema: S.Codec<To, From>,
96
96
  trans: TransFn
97
97
  ): StandardSchemaV1<From, To> => {
98
98
  const { checkHook, leafHook } = makeStandardSchemaV1Hooks(trans)
@@ -117,7 +117,7 @@ const isLiteralUnion = (ast: S.AST.AST): ast is S.AST.Union<S.AST.Literal> =>
117
117
  const walkAst = (ast: S.AST.AST, trans: TransFn): S.AST.AST => {
118
118
  if (isLiteralUnion(ast)) {
119
119
  if (ast.annotations?.message !== undefined) return ast
120
- const members = ast.types.map((t) => (t as S.AST.Literal).literal)
120
+ const members = ast.types.map((t) => t.literal)
121
121
  return new S.AST.Union(
122
122
  ast.types,
123
123
  ast.mode,
@@ -153,9 +153,9 @@ const walkAst = (ast: S.AST.AST, trans: TransFn): S.AST.AST => {
153
153
  if (
154
154
  ast.annotations?.message === undefined
155
155
  && ast.rest.length === 1
156
- && isLiteralUnion(ast.rest[0]!)
156
+ && isLiteralUnion(ast.rest[0])
157
157
  ) {
158
- const members = (ast.rest[0]! as S.AST.Union<S.AST.Literal>).types.map((t) => t.literal)
158
+ const members = ast.rest[0].types.map((t) => t.literal)
159
159
  annotations = {
160
160
  ...ast.annotations,
161
161
  message: trans("validation.not_a_valid", { type: "multiple", message: members.join(", ") })
@@ -194,9 +194,9 @@ const walkAst = (ast: S.AST.AST, trans: TransFn): S.AST.AST => {
194
194
  }
195
195
 
196
196
  export const annotateLiteralUnionMessages = <To, From>(
197
- schema: S.Codec<To, From, never, never>,
197
+ schema: S.Codec<To, From>,
198
198
  trans: TransFn
199
- ): S.Codec<To, From, never, never> => {
199
+ ): S.Codec<To, From> => {
200
200
  const newAst = walkAst(schema.ast, trans)
201
- return newAst === schema.ast ? schema : S.make(newAst) as S.Codec<To, From, never, never>
201
+ return newAst === schema.ast ? schema : S.make(newAst)
202
202
  }