Skip to content

Jsdoc is lost #1570

@nanianlisao

Description

@nanianlisao

After executing npx tsc, jsdoc is lost
input:

import { type } from 'arktype';

export const UserSchema = type({
  /** User name */
  name: 'string',
  /** Age (optional) */
  'age?': 'number',
});

export type UserType = typeof UserSchema.infer;

output:

export declare const UserSchema: import("arktype/internal/variants/object.ts").ObjectType<{
    name: string;
    age?: number | undefined;
}, {}>;
export type UserType = typeof UserSchema.infer;

my tsconfig is

{
  "compilerOptions": {
    "strict": true,
    "preserveSymlinks": false,
    "target": "ESNext",
    "moduleResolution": "bundler",
    "outDir": "lib",
    "declaration": true,
  }
}

If I set preserveSymlinks to true, the generated dts retains the jsdoc, but is actually wrong. So, is there a better way I can do this? I don't want to declare interface separately, but through typeof schema.infer

Thank you very much for your efforts. This library has helped me a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions