
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
@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
The npm package @cortexql/ts2graphql receives a total of 17 weekly downloads. As such, @cortexql/ts2graphql popularity was classified as not popular.
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
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.