Skip to content

Import default issue (Cannot read properties of undefined) #31

@ak99372

Description

@ak99372

Can someone shed some light on default import (using Typescript). This is the code using default import (matching the types from index.d.ts)

import hyperactiv from "hyperactiv";
export const observe = hyperactiv.observe;

but then during run time default is undefined

exports.observe = hyperactiv_1.default.observe;
                                       ^
TypeError: Cannot read properties of undefined (reading 'observe')

if I do instead import * as hyperactiv from "hyperactiv"; then compiler complains about hyperactiv.observe but it works at runtime.

(my tsconfig: "module": "CommonJS")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions