Skip to content

Commit 3218783

Browse files
Copilothotlong
andcommitted
refactor: Replace 'any' types with 'unknown' for better type safety
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent faad912 commit 3218783

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

packages/objectstack/runtime/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface RuntimePlugin {
3737
*/
3838
export class ObjectStackKernel {
3939
/** Query interface (QL) */
40-
public ql: any = null;
40+
public ql: unknown = null;
4141

4242
constructor(plugins: RuntimePlugin[] = []) {
4343
// Stub implementation
@@ -59,22 +59,22 @@ export class ObjectStackKernel {
5959
}
6060

6161
/** Find records */
62-
async find(objectName: string, query: any): Promise<{ value: any[]; count: number }> {
62+
async find(objectName: string, query: unknown): Promise<{ value: unknown[]; count: number }> {
6363
return { value: [], count: 0 };
6464
}
6565

6666
/** Get a single record */
67-
async get(objectName: string, id: string): Promise<any> {
67+
async get(objectName: string, id: string): Promise<unknown> {
6868
return {};
6969
}
7070

7171
/** Create a record */
72-
async create(objectName: string, data: any): Promise<any> {
72+
async create(objectName: string, data: unknown): Promise<unknown> {
7373
return data;
7474
}
7575

7676
/** Update a record */
77-
async update(objectName: string, id: string, data: any): Promise<any> {
77+
async update(objectName: string, id: string, data: unknown): Promise<unknown> {
7878
return data;
7979
}
8080

@@ -84,12 +84,12 @@ export class ObjectStackKernel {
8484
}
8585

8686
/** Get metadata for an object */
87-
getMetadata(objectName: string): any {
87+
getMetadata(objectName: string): unknown {
8888
return {};
8989
}
9090

9191
/** Get view configuration */
92-
getView(objectName: string, viewType?: 'list' | 'form'): any {
92+
getView(objectName: string, viewType?: 'list' | 'form'): unknown {
9393
return null;
9494
}
9595
}

packages/objectstack/spec/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface FilterNode {
2828
type: 'and' | 'or' | 'not' | 'comparison';
2929
operator?: string;
3030
field?: string;
31-
value?: any;
31+
value?: string | number | boolean | null | Date;
3232
children?: FilterNode[];
3333
}
3434

@@ -147,7 +147,7 @@ export interface Field {
147147
/** Whether the field is searchable */
148148
searchable?: boolean;
149149
/** Default value */
150-
defaultValue?: any;
150+
defaultValue?: string | number | boolean | null;
151151
/** Maximum length for strings */
152152
maxLength?: number;
153153
/** Minimum length for strings */
@@ -165,7 +165,7 @@ export interface Field {
165165
/** Reference to another object (for lookup/master_detail) */
166166
reference?: string;
167167
/** Filters for reference field */
168-
referenceFilters?: any;
168+
referenceFilters?: FilterCondition;
169169
/** Whether write requires master read permission */
170170
writeRequiresMasterRead?: boolean;
171171
/** Summary expression */
@@ -332,9 +332,9 @@ export interface DriverInterface {
332332
*/
333333
export interface DriverOptions {
334334
/** Connection string or configuration */
335-
connection?: string | any;
335+
connection?: string | Record<string, unknown>;
336336
/** Additional driver-specific options */
337-
[key: string]: any;
337+
[key: string]: unknown;
338338
}
339339

340340
/**

0 commit comments

Comments
 (0)