Gathering detailed insights and metrics for ts-interface-keys-transformer
Gathering detailed insights and metrics for ts-interface-keys-transformer
Gathering detailed insights and metrics for ts-interface-keys-transformer
Gathering detailed insights and metrics for ts-interface-keys-transformer
ts-interface-keys-transformer-plugin
It parses the interface information during the compilation phase of TypeScript.
ts-interface-key
`ts-interface-key` is inspired by [ts-transformer-keys](https://github.com/kimamula/ts-transformer-keys). It uses a custom transformer to parse the keys in 'interface' and 'type' in compile stage in TypeScript which support nested keys and optionality.
ts-transform-contextual-keys
TypeScript custom transformer able to extract interface keys contextually
npm install ts-interface-keys-transformer
Typescript
Module System
Node Version
NPM Version
71.6
Supply Chain
98.9
Quality
75.8
Maintenance
100
Vulnerability
99.6
License
TypeScript (98.42%)
JavaScript (1.58%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
28 Stars
49 Commits
8 Forks
14 Branches
1 Contributors
Updated on Jun 04, 2025
Latest Version
2.3.2
Package Id
ts-interface-keys-transformer@2.3.2
Size
5.63 kB
NPM Version
6.13.4
Node Version
10.19.0
Published on
Aug 05, 2020
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
6
ts-interface-keys-transformer
is inspired by ts-transformer-keys.
It uses a custom transformer to parse the keys in 'interface' and 'type' in compile stage in TypeScript
which support nested keys and optionality.
1$ npm i -D typescript ttypescript ts-interface-keys-transformer
and then add following to "compilerOptions" field in tsconfig.json:
1"plugins": [ 2 { "transform": "ts-interface-keys-transformer/transformer" } 3 ]
Use following command to run (assume index.js is the compiled file of index.ts):
1$ ttsc -p tsconfig.json && node index.js
1import { keys } from 'ts-interface-keys-transformer'; 2 3interface Foo { 4 a: string; 5 readonly b: number; 6 c?: boolean; 7} 8// [ { name: 'a', modifiers: [], optional: false, type: 'string' }, 9// { name: 'b', modifiers: [ 'readonly' ], optional: false, type: 'number' }, 10// { name: 'c', modifiers: [], optional: true, type: 'boolean' } ] 11console.log(keys<Foo>());
1import { keys } from 'ts-interface-keys-transformer'; 2 3interface Foo { 4 a: string; 5 b: { 6 b1: string; 7 b2: number; 8 }, 9 c: string[]; 10 d: Array<{ 11 d1: string; 12 d2: number; 13 }>; 14} 15// [ { "name": "a", "modifiers": [], "optional": false, "type": "string" }, 16// { "name": "b", "modifiers": [], "optional": false, "type": "object" }, 17// { "name": "b.b1", "modifiers": [], "optional": false, "type": "string" }, 18// { "name": "b.b2", "modifiers": [], "optional": false, "type": "number" }, 19// { "name": "c", "modifiers": [], "optional": false, "type": "array", "elementType": "string" }, 20// { 21// "name": "d", 22// "modifiers": [], 23// "optional": false, 24// "type": "Array", 25// "elementKeys": [ 26// { 27// "name": "d1", 28// "modifiers": [], 29// "optional": false, 30// "type": "string" 31// }, 32// { 33// "name": "d2", 34// "modifiers": [], 35// "optional": false, 36// "type": "number" 37// } 38// ] 39// } ] 40console.log(keys<Foo>());
1import { keys } from 'ts-interface-keys-transformer'; 2 3interface Foo { 4 a: string; 5} 6interface Bar { 7 b: string; 8} 9// [ { "name": "a", "modifiers": [], "optional": false, "type": "string" }, 10// { "name": "b", "modifiers": [], "optional": false, "type": "string" } ] 11console.log(keys<Foo & Bar>());
1import { keys } from 'ts-interface-keys-transformer'; 2 3interface Foo { 4 a: string; 5} 6interface Bar { 7 a: string; 8 b: string; 9} 10// [ { "name": "a", "modifiers": [], "optional": false, "type": "string"} ] 11console.log(keys<Foo | Bar>());
See more test cases in Tests
1npm run build
1npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
43 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More