
Security News
pnpm 10.12 Introduces Global Virtual Store and Expanded Version Catalogs
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
@cortexql/ts2graphql
Advanced tools
A runtime tranpiler and generator that converts your TypeScript code into GraphQL types
Set your enviroment to have the following directories
Include all GraphQL types in separated files that export the TypeScript type.
Interface TypeScript types are converted to GraphQL Input Object Type
// types/Login.ts
/**
* Login input
*/
export interface Login {
/**
* The user's email address
*/
email: string;
/**
* The user's plain password
*/
password: string;
}
// schema/Login.graphql
# Login input
input Login {
# The user's email address
email: String!
# The user's plain password
password: String!
}
Class TypeScript types are converted to GraphQL Object Type
// types/User.ts
import { Post } from './Post';
/**
* User object
*/
export class User {
/**
* The user's unique id
*/
id: string;
/**
* The user's email address
*/
email: string;
/**
* The user's plain password
* @GraphQL.disable
*/
password: string;
/**
* Get latest user's posts
*/
async getLatestPosts(
args: {
/**
* The maximum number of posts to fetch
*/
limit?: number = 10
},
context: any
): Promise<Post[]> {
// ...
}
/**
* Check user password
* @GraphQL.disable
*/
checkPassword(password: string): boolean {
// ...
}
}
// schema/User.graphql
# User object
type User {
# The user's unique id
id: String!
# The user's email address
email: String!
# Get latest user's posts
getLatestPosts(
# The maximum number of posts to fetch
limit: Float = 10
): [Post]
}
ts2graphql -p src -o build/graphql
TODO: More examples and tutorials
FAQs
A TypeScrpt transpiler to GraphQL for your project
We found that @cortexql/ts2graphql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.