
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
dts-element
Advanced tools
A DOM library for generation TypeScript declaration (.d.ts) files
Changelog - Examples - Documentation
FunctionDeclaration
: it can be method or function based on where it is.VariableDeclaration
: it can be property or variable based on where it is.dts-element
using dts.parse()
, useful for restructuring typesusing npm
npm install --save dts-element
using yarn
yarn add dts-element
Code
import * as dts from 'dts-element';
const getThing = dts.create_function_declaration({
name: 'getThing',
type: dts.create_function_type({
parameters: [
dts.create_parameter_declaration({
name: 'x',
type: dts.number_type,
}),
],
return: dts.void_type,
}),
}); // equivalent to dts.parse('function getThing(x: number): void;').members[0];
const MyInterface = dts.create_interface_declaration({
name: 'MyInterface',
jsdoc: 'This is my nice interface',
type: dts.create_object_type({
members: [
dts.create_object_member({
optional: true,
owned: getThing,
}),
],
}),
});
const SomeNamespace = dts.create_namespace_declaration({
name: 'SomeNamespace',
members: [MyInterface],
});
console.log(dts.emit(
dts.create_top_level_element({
members: [SomeNamespace],
}),
));
Output
declare namespace SomeNamespace {
/**
* This is my nice interface
*/
interface MyInterface {
getThing?(x: number): void;
}
}
# test
yarn run test
# build
yarn run build
# lint
yarn run lint
# generate docs
yarn run docs
FAQs
A DOM library for generation TypeScript declaration (.d.ts) files
The npm package dts-element receives a total of 617 weekly downloads. As such, dts-element popularity was classified as not popular.
We found that dts-element demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.