Skip to content

Commit 0459d1a

Browse files
committed
declare var process
1 parent f479b80 commit 0459d1a

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

packages/component/src/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,17 @@ const hooks = {
6565
...componentHooks
6666
};
6767

68-
const buildTool = (process as any).env.build_tool;
69-
const moduleFormat = (process as any).env.module_format;
70-
const version = (process as any).env.npm_package_version;
68+
declare const process: {
69+
env: {
70+
build_tool: string;
71+
module_format: string;
72+
npm_package_version: string;
73+
};
74+
};
75+
76+
const buildTool = process.env.build_tool;
77+
const moduleFormat = process.env.module_format;
78+
const version = process.env.npm_package_version;
7179

7280
const buildInfo = { buildTool, moduleFormat, version };
7381

packages/react-valibot/src/validateProps.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import { parse, safeParse, type BaseIssue, type BaseSchema, type InferInput, typ
99
*/
1010
type IsolationMode = 'no isolation' | 'strict';
1111

12+
declare const process: {
13+
env: {
14+
NODE_ENV?: string | undefined;
15+
};
16+
};
17+
1218
export default function validateProps<const TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(
1319
propsSchema: TSchema,
1420
props: unknown,
@@ -36,8 +42,7 @@ export default function validateProps<const TSchema extends BaseSchema<unknown,
3642
props: InferInput<TSchema>,
3743
isolationMode?: IsolationMode | undefined
3844
): InferInput<TSchema> | InferOutput<TSchema> {
39-
// @ts-expect-error Accessing process without @types/node.
40-
if ((process as any).env.NODE_ENV === 'production') {
45+
if (process.env.NODE_ENV === 'production') {
4146
return props as unknown as InferInput<TSchema>;
4247
}
4348

0 commit comments

Comments
 (0)