Comments (1)
Hi, sorry for the slow response. I checked and tuples work as members of an object, so if nothing else you can create a pointless wrapper around the actual tuple, e.g.
const factory = Sync.makeFactory<{ foo: [number, number] }>(
{
_: Sync.each((seq) => [seq * 2, seq * 2 + 1]),
},
{ startingSequenceNumber: 1 }
);
const tupleBuilder = () => factory.build()._;
const value = tupleBuilder();
expect(value.foo).toEqual([2, 3]);
I don't have a good solution (yet) for giving a different Generator to each element of the tuple, although there are reasonable ways around this by passing the seqNum down to each element. Also, this be aided by the work I'm trying to do to address #55.
from factory.ts.
Related Issues (20)
- Can't type "bindBuild" method w/ TS 3.5.2
- [Question] Can we nested the factory ? HOT 2
- Getting type error with typescript 3.4.1 (and later) using combine HOT 4
- How to randomize buildList results HOT 5
- [Feature request]: makeFactory accepts function parameter HOT 3
- [feature proposal] Allow to specify factory as field default value of another factory HOT 1
- Use value from another field HOT 5
- Current state of the library HOT 2
- Node version bump causes install to fail HOT 2
- Can't use Factory.each to custimize value of build HOT 1
- Derivation using the existing value HOT 2
- Feature request: `create` and `createList`
- Feature request: `resetAllSequenceNumbers`
- Feature request: pass to makeFactory function that returns Builder instead object Builder HOT 1
- This repo does not seem maintained anymore HOT 2
- Combine factories with optional field HOT 3
- Pipelines as generators HOT 1
- Failed to parse source maps HOT 1
- How to randomise nested object key in `buildList` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from factory.ts.