
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
dts-dom is a library for programatically generating TypeScript declaration files.
It is based mostly on the same CodeDOM provided for C# and other .NET languages.
dts-dom automatically handles indentation, formatting, and proper placement of declare and export keywords.
As with other CodeDOM libraries, this is overkill for small projects, but is useful in more complex code generation scenarios.
PRs gladly accepted as this is mostly implemented on an as-needed basis for another project.
npm install --save dts-dom
import * as dom from 'dts-dom';
const intf = dom.create.interface('MyInterface');
intf.jsDocComment = 'This is my nice interface';
intf.members.push(dom.create.method(
'getThing',
[dom.create.parameter('x', dom.type.number)],
dom.type.void,
dom.DeclarationFlags.Optional));
const ns = dom.create.namespace('SomeNamespace');
ns.members.push(intf);
console.log(dom.emit(ns));
This writes out the block:
declare namespace SomeNamespace {
/**
* This is my nice interface
*/
interface MyInterface {
getThing?(x: number): void;
}
}
unknown0 are now correctly printedNew Functionality: Added the ability to emit export default assignments
const module = create.module('my-module');
const constDeclaration = create.const('test', 'string');
const exportDefault = create.exportDefault('test');
module.members.push(constDeclaration, exportDefault);
const s = emit(module);
Produces:
declare module 'my-module' {
const test: string;
export default test;
}
Non-breaking Change: Superfluous declare keywords are no longer emitted inside module declarations
New Functionality: Added the ability to emit triple-slash directives #39
const tripleSlashDirectives = [create.tripleSlashReferenceTypesDirective("react")];
const returnType = create.namedTypeReference('JSX.Element');
const component = create.function('Component', [], returnType, DeclarationFlags.Export);
const s = emit(component, { tripleSlashDirectives });
Produces:
/// <reference types="react" />
export function Component(): JSX.Element;
Breaking Change: Changed the second parameter of emit from ContextFlags to EmitOptions #39
// 1.0
const s = emit(tree, ContextFlags.Module);
// 2.0
const s = emit(tree, { rootFlags: ContextFlags.Module });
The same as 0.1.25
The major version will be bumped if:
The major version will not be bumped if:
The following people have contributed features and/or bug fixes. Thank you!
FAQs
DOM for TypeScript Declaration Files
The npm package dts-dom receives a total of 4,733 weekly downloads. As such, dts-dom popularity was classified as popular.
We found that dts-dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.