Skip to content

@curveball/validator is a devDependency but imported at runtime #185

Open
@arild-haugstad

Description

@arild-haugstad

html-index.tsx has a line

import '@curveball/validator';
but @curveball/validator is a devDependency.

This was introduced in 5981787, and the purpose appears to be to to modify the type of Context to have member schemas via the declaration in https://github.com/curveball/validator/blob/3259fb6ac3a7decce51307668efea9462fc3247f/src/declarations.ts

Unfortunately, this import statement becomes part of the output in dist/html-index.js -- which has no obvious effect if @curveball/validator is installed, but leads to error ERR_MODULE_NOT_FOUND if it is not installed.

I believe that the "right" way of expressing import purely for side-effects on types would be

/// <reference types="@curveball/validator" />

at the start of html-index.tsx instead of the import statement; this loads the appropriate type information for type check, but without an import of @curveball/validator in the output; at least it does on my computer...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions