TypeScript support
Since v2.0, DHTMLX RichText ships with built-in TypeScript definitions that require no extra setup.
note
Try out the editor in the Snippet Tool.
Advantages of TypeScript
TypeScript with DHTMLX RichText gives you:
- type safety — the compiler catches misuse of configuration properties and method arguments at build time
- autocompletion — your IDE suggests valid property names, method signatures, and value types as you type
- self-documenting API — type annotations on the configuration object and methods double as inline documentation
Initialize RichText in TypeScript
The example below initializes RichText in TypeScript with autocompletion from the bundled type definitions:
import { Richtext } from "@dhx/richtext";
const editor = new Richtext("#root", {
menubar: true,
layoutMode: "document"
});
Reference API types
For TypeScript signatures of every configuration property, see the Properties overview. For method signatures, see the Methods overview.