-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interface generation/references (#288)
* Add basic interface to test generation * Add places that need to be updated to handle generating interfaces * Add imports for the possibleTypes of an interface and generate TS type * Add root store imports for unions AND interfaces * Use the generated type for interfaces if using TS * Fix rogue comma in generation based on a missing .join("") call * Update snapshot for interface generation * Put babelrc back so tests pass * Remove unneeded transform in babelrc so rollup can build successfully https://www.npmjs.com/package/@rollup/plugin-babel#modules * yarn test updated these files for some reason? * Remove unneeded interface from example 3 Co-authored-by: Jesse Savary <[email protected]>
- Loading branch information
1 parent
f9a4f97
commit 9438884
Showing
6 changed files
with
63 additions
and
32 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
examples/3-twitter-clone/src/app/models/BaseIDModelSelector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* This is a mst-gql generated file, don't modify it manually */ | ||
/* eslint-disable */ | ||
/* tslint:disable */ | ||
|
||
import { QueryBuilder } from "mst-gql" | ||
import { MessageModelType } from "./MessageModel" | ||
import { MessageModelSelector } from "./MessageModel.base" | ||
import { UserModelType } from "./UserModel" | ||
import { UserModelSelector } from "./UserModel.base" | ||
|
||
export type BaseIDUnion = UserModelType | MessageModelType | ||
|
||
export class BaseIDModelSelector extends QueryBuilder { | ||
get id() { return this.__attr(`id`) } | ||
user(builder?: string | UserModelSelector | ((selector: UserModelSelector) => UserModelSelector)) { return this.__inlineFragment(`User`, UserModelSelector, builder) } | ||
message(builder?: string | MessageModelSelector | ((selector: MessageModelSelector) => MessageModelSelector)) { return this.__inlineFragment(`Message`, MessageModelSelector, builder) } | ||
} | ||
export function selectFromBaseID() { | ||
return new BaseIDModelSelector() | ||
} | ||
|
||
export const baseIDModelPrimitives = selectFromBaseID() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters