My goal is to streamline the output in the TypeScript declaration files (*.d.ts) that come with the bundled version of my module's code. This involves a process that includes the TypeScript compiler, Babel, and Rollup. I'm also utilizing Relay and GraphQL, although that shouldn't have much impact on the question I have.
For example, in my .tsx source code, I have the following:
import { graphql } from 'babel-plugin-relay/macro'
// Generates some code
graphql`fragment task_model on Task { id message createdAt deadline modifiers { hard medium easy } }`
// A generated type exists for this fragment, but it's not very aesthetic
import { task_model } from './__generated__/task.graphql'
// I want to improve the type information and export it with a better name
export type Task = Readonly<Omit<task_model & { deadline: string, createdAt: string }, ' $refType'>>
In the resulting .d.ts file, the content looks like this:
export declare type Task = Readonly<Omit<task_model & {
deadline: string;
createdAt: string;
}, ' $refType'>>;
However, when viewed within an IDE, I notice that the type actually resolves to a more readable format:
type Task = {
readonly id: string;
readonly message: string;
readonly createdAt: string;
readonly deadline: string;
readonly modifiers: {
readonly hard: number;
readonly medium: number;
readonly easy: number;
};
}
Is there an option or method to output this cleaner, human-readable type resolution instead of the corrected version? It would be beneficial for understanding the type information even if the consumer project isn't configured properly.