
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
interface-decorators
Advanced tools
Interface decorators for JavaScript
You'll need babel in your project, see notes.
// rollup.config.js
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import babel from '@rollup/plugin-babel'
export default [{
input: 'src/index.js',
output: {
file: 'public/index.js',
format: 'esm',
name: 'core'
},
plugins: [
babel({
sourceMap: true,
include: ['src/**/*'],
extensions: ['.js'],
plugins: [
'@babel/plugin-proposal-class-properties',
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: false }]
]
}),
resolve(),
commonjs(),
]
}]
import { Interface, implement, isImplementing } from 'interface-decorators'
@Interface
class Serializable {
serialize () {}
static deserialize () {}
}
@Interface
class Entity {
distanceTo () {}
}
@implement(Serializable, Entity)
class Player {
// has to implement serialize, distanceTo and static deserialize
}
const player = new Player()
isImplementing(Player, Entity) // true
isImplementing(player.constructor, Serializable, Entity) // true
Well, decorators are not part of the official spec and may never be. By the time of writing this readme they are in stage-2 proposal
I have no idea if they'll work in typescript or not i'm a js dev, not a ts one.
FAQs
Interface decorators for JavaScript
We found that interface-decorators 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.