Extract any definition from TS definitions file
This program is not pure-ESM. For pure-ESM, use tsd-extract instead. Both have the same API and the same features.
npm i tsd-extract-noesmimport { strict as assert } from "assert";
import { extract } from "tsd-extract-noesm";
const { value } = extract(
`interface Opts1 { foo: boolean };
interface Opts2 { bar: boolean };`,
"Opts2"
);
assert.equal(value, "interface Opts2 { bar: boolean };");This is a clone of tsd-extract but in non-ESM configuration.
We needed it because mdx-bundler (as of v9) uses @esbuild-plugins/node-resolve which in turn, uses resolve which does not support ESM packages which have exports pointing to anything else than index.js.
Please visit codsen.com for a full description of the API.
To report bugs or request features or assistance, raise an issue on GitHub.
MIT License
Copyright (c) 2010-2022 Roy Revelt and other contributors

