Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

type-genius

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-genius - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

jest.config.js

22

package.json
{
"name": "type-genius",
"version": "0.0.1",
"version": "0.0.2",
"description": "",
"main": "index.js",
"main": "./dist/index.js",
"author": "Mike Carbone",
"repository": {
"url": "https://github.com/MikeCarbone/type-genius"
},
"scripts": {
"build": "tsc",
"prepare": "npm run build",
"test": "jest"
},
"license": "ISC",
"types": "./index.d.ts",
"types": "./dist/index.d.ts",
"dependencies": {
"deep-equal": "^2.2.0"
},
"devDependencies": {
"@types/deep-equal": "^1.0.1",
"@types/jest": "^29.4.0",
"@types/node": "^18.14.1",
"jest": "^29.4.3",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
}
}

33

README.md

@@ -18,3 +18,3 @@ # Type Genius

```ts
import {} from "type-genius";
import { buildTypes } from "type-genius";

@@ -26,5 +26,22 @@ // Get some data

// Generate type file
types(data);
buildTypes(data);
```
## Options
The `buildTypes` function takes a second parameter where you can pass an options object. Below are the expected keys for that option object.
| **Option Name** | **Type** | **Default** | **Description** |
|---|---|---|---|
| customTypes | Object? | ```js { string: "string", number: "number", boolean: "boolean", object: "object" } ``` | Customize the types that get rendered. For objects, you can render a Record like this: ```js customTypes: { object: "Record<string, unknown>" ``` |
| forceOptional | Boolean? | false | Forces each value in every type to be optional. |
| initialInterfaceName | String? | "Response" | The name given to the first generated interface. |
| logSuccess | Boolean? | false | Should a success message get rendered after successfully generating the types. |
| outputFilename | String? | "exported.d.ts" | File name to give the rendered types file. |
| outputPath | String? | "../dist/" | Where to render the generated types. |
| renderSemis | Boolean? | false | Render semicolons in the outputted file. |
| skipFileWrite | Boolean? | false | Whether to write the file or not. |
| useStore | TypeStore? | [] | Store of existing InterfaceConfiguration objects to use for this generation. |
| useTypes | Boolean? | false | Whether to render "type"s instead of "interface"s. |
## Architecture

@@ -143,13 +160,1 @@

At this stage, each interface configuration string is concatenated into a single string. This big string will get written to a file, and exported with the specified options.
## Options
- Return configurations
- Initial interface name
- Output path
- Output filename
- Customize unknown type
- Customeize all types
- Everything optional
- Use types instead of interfaces
- Render semi-colons
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc