Skip to content
中文

Support ​

SUPPORT · namespace · Runtime value

Import ​

ts
import { Support } from '@jangts/agent-core';
js
import { Support } from '@jangts/agent-core';

Other public entry points:@jangts/agent-core, @jangts/agent-core/types.

Definition ​

Namespace: Support

Namespace index ​

Examples ​

Beginner · Node.js

ts
import { Support } from '@jangts/agent-core';
const schema = Support.defineSchema({ jsonSchema: { type: 'string' },
  parse(value: unknown) { if (typeof value !== 'string') throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));
js
import { Support } from '@jangts/agent-core';
const schema = Support.defineSchema({ jsonSchema: { type: 'string' },
    parse(value) { if (typeof value !== 'string')
        throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));

Change only the import granularity; contract and call stay the same ​

Configuration · Node.js

ts
import { defineSchema } from '@jangts/agent-core/support';
const schema = defineSchema({ jsonSchema: { type: 'string' },
  parse(value: unknown) { if (typeof value !== 'string') throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));
js
import { defineSchema } from '@jangts/agent-core/support';
const schema = defineSchema({ jsonSchema: { type: 'string' },
    parse(value) { if (typeof value !== 'string')
        throw new TypeError('需要文本'); return value; },
});
console.log(schema.parse('你好'));

API reference, usage examples and developer guides.