Skip to content

type-compiler produces empty ops for some types and broken output #352

@wielski

Description

@wielski

type-compiler produces empty ops for type Result from https://github.com/traverse1984/oxide.ts

import { Result } from 'oxide.ts';
export type MyResult = Result<number, Error>;

causes broken output:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.__ΩMyResult = void 0;
const __ΩMyResult; <--- empty
exports.__ΩMyResult = __ΩMyResult;
//# sourceMappingURL=index.js.map

with error 'Const declarations' require an initialization value.

Result is both type and a class constructor.

It happens because of extractPackStructOfTypeReference calls for extractPackStructOfType with node FunctionDeclaration, that stops working because of config.mode is never.
I suspect it happens because of findReflectionFromPath reading tsconfig.json from oxide.ts inside node_modules folder, and returns never cause there is no reflection field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions