rodmax / factory-t Goto Github PK
View Code? Open in Web Editor NEWLibrary for building JavaScript/TypeScript objects... with strong typing in mind
License: MIT License
Library for building JavaScript/TypeScript objects... with strong typing in mind
License: MIT License
const factory = new FactoryT<{key: {nested: string}}>({
key: {nested: '123'} // !!! seems not working
});
``
When call buildList
with only count
param which equal to 0
method throws error
factory.buildList({ count: 0})
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Location: .github/renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Configuration option 'ignorePaths' should be a list (Array)
changelog bump, etc
This issue provides visibility into Renovate updates and their statuses. Learn more
These updates are pending. To force PRs open, click the checkbox below.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@commitlint/cli
, @commitlint/config-conventional
)@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)Hi @rodmax,
First, I wanted to thank you for this great library. Lightweight, with strong typings, and it has covered all my use cases so far. Awesome job!
I found an issue when working with optional properties, though. Usually, optional properties are not included in the factory definition (that's why they are optional, right?). However, at this point, it's not possible to add a value for an optional property using the partial
param of .item(..)
for example.
The only workaround I found is to set the property in the factory definition as undefined
. But IMHO, I think that defies the purpose of an optional property, and it's also a little cumbersome to add undefined
for all optional properties to avoid this issue.
Here's an example in a small playground I created: https://codesandbox.io/s/factory-t-playground-r9ueq?file=/src/index.ts
Let me know if this makes sense to you. Also, I'll be happy to help out with a PR if you point me in the right direction.
Cheers!
TODO: explain reason and new approach
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.