loginterface
v1.3.3
Published
Stop writing types manually. Auto-generate TypeScript interfaces to your console in runtime.
Downloads
1,945
Maintainers
Readme
🚀 logInterface
Turn API responses into TypeScript interfaces instantly.
Stop writing types manually. Auto-generate TypeScript interfaces to your console in runtime.
Important note, there is an extension for this functionality as well
https://chromewebstore.google.com/detail/fkepnoamaphfmpdlallaioglfigdjema?utm_source=item-share-cb
✨ Features
- Deep Nesting Support: Automatically creates sub-interfaces for objects and arrays.
- Zero Configuration: Just pipe it into your observable and copy-paste the result.
- Visual Styling: Beautifully formatted console logs that stand out from standard debug noise.
📦 Installation
npm install loginterfaceExample usage (Angular) option 1: Using logInterface operator
import { logInterface } from 'loginterface';
this.http.get('/endpoint').pipe(logInterface('Interface name'))Example response
const person = {
name: 'John',
lastname: 'Doe',
age: 30,
address:{
street: 'Highroad',
number: 100
},
items: [
{ pencil: true, gloves: true }
]
}
of(person).pipe(logInterface('Person')).subscribe()
//will log the following into console
export interface Person {
name: string;
lastname: string;
age: number;
address: Address;
items: Items[];
}
interface Address {
street: string;
streetNumber: number;
}
interface Items {
pencil: boolean;
gloves: boolean;
}
In case u dont use RxJs, same can be achieved by importing logInterfaceFor directly and call it
const person = {
name: 'John',
lastname: 'Doe',
age: 30,
address:{
street: 'Highroad',
number: 100
},
items: [
{ pencil: true, gloves: true }
]
}
logInterfaceFor(person, 'Person');
//will log the same output
💡 Why use LogInterface?
Manually writing TypeScript interfaces for complex, nested JSON is the ultimate productivity killer.
With LogInterface, you don't have to guess or type a single bracket. Just navigate through your app as you normally would, and your browser console becomes a live interface generator.
- Instant Results: Interfaces appear the moment your API responds.
- Copy-Paste Workflow: No more switching between browser tabs and IDE to map fields.
