Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions packages/builder/test/type-exports.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Test file to verify TypeScript type exports work correctly
* This file should compile without errors when types are properly exported
*/

import type { FieldConfig } from '../src/types';
import type {
RuleType,
OperatorsType,
Constraint,
ConditionType,
Condition,
} from '@usex/rule-engine';
import { Operators, ConditionTypes } from '../src/index';

// Test that types are available
const _testFieldConfig: FieldConfig = {
name: 'test.field',
label: 'Test Field',
type: 'string',
description: 'A test field',
};

const _testRule: RuleType = {
conditions: [],
};

const _testCondition: Condition = {
[ConditionTypes.AND]: [],
};

const _testConstraint: Constraint = {
field: 'test.field',
operator: Operators.Equals,
value: 'test',
};

// Verify we can use the exported operators
const _testOperator: OperatorsType = Operators.Equals;
const _testConditionType: ConditionType = ConditionTypes.AND;

console.log('Type imports work correctly!');
22 changes: 22 additions & 0 deletions packages/builder/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"noEmit": false,
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": false,
"outDir": "dist",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": [
"src/demo.tsx",
"src/main.tsx",
"src/vite-env.d.ts",
"src/**/*.test.ts",
"src/**/*.test.tsx",
"src/**/*.spec.ts",
"src/**/*.spec.tsx"
]
}
4 changes: 4 additions & 0 deletions packages/builder/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export default defineConfig({
entryRoot: "src",
outDir: "dist",
insertTypesEntry: true,
tsconfigPath: "./tsconfig.build.json",
compilerOptions: {
preserveSymlinks: false,
},
}),
nodePolyfills({
include: ["crypto", "stream", "vm", "buffer", "path", "url"],
Expand Down