How to import `arktype` into a typescript project?

I do it like this:
import { type } from 'arktype';


However, I get an error:
The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("arktype")' call instead.
  To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `"type": "module"` to '....../package.json'.ts(1479)


I tried to specify path to cjs version, but it didn't work:
import { type } from 'arktype/cjs'; // Cannot find module 'arktype/cjs' or its corresponding type declarations.ts(2307)
import { type } from 'arktype/cjs/main'; // Cannot find module 'arktype/cjs/main' or its corresponding type declarations.ts(2307)


How to get it imported?
Was this page helpful?