Skip to content

Cannot set property default of #<Object> which has only a getter #37090

Description

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms: which has only a getter

Code

https://github.com/bluelovers/ws-react/blob/master/packages/react-use-localstorage/src/core.ts

export * from './core/v4';
import createStorageHook from './core/v4';
export default createStorageHook
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (!exports.hasOwnProperty(p)) __createBinding(exports, m, p);
}
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./core/v4"), exports);
const v4_1 = __importDefault(require("./core/v4"));
exports.default = v4_1.default;
//# sourceMappingURL=core.js.map

Expected behavior:

no crash error

Actual behavior:

TypeError: Cannot set property default of # which has only a getter

Playground Link:

Related Issues:

#37092

Activity

  1. bluelovers commented on Mar 5, 2020

    @bluelovers
    ContributorAuthor

    if move down export * after export default will not have this error

    but i think this should not happen

    import createStorageHook from './core/v4';
    export default createStorageHook
    export * from './core/v4';

    Related PR:
    #35967
    #37236

    Related Issues:
    #37234

  2. rokoroku commented on Jun 10, 2020

    @rokoroku

    Maybe related: microsoft/tslib#103 ?

    I went through the same issue and I solved it by downgrading tslib to 1.13.0


    ADD: typescript@3.9.5, tslib@2 resolves the issue for me.

  3. rbuckton commented on Jul 8, 2020

    @rbuckton
    Contributor

    This was fixed by #38808.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Needs InvestigationThis issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions