Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bluelovers opened this issue Feb 27, 2020 · 3 comments
Closed

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

bluelovers opened this issue Feb 27, 2020 · 3 comments
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status. Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@bluelovers
Copy link
Contributor

bluelovers commented Feb 27, 2020

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

@bluelovers
Copy link
Contributor Author

bluelovers commented Mar 5, 2020

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

@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.9.0 milestone Mar 10, 2020
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Mar 10, 2020
bluelovers added a commit to bluelovers/gm-user-scripts that referenced this issue Apr 1, 2020
@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label May 20, 2020
@rokoroku
Copy link

rokoroku commented Jun 10, 2020

Maybe related: microsoft/tslib#103 ?

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


ADD: [email protected], tslib@2 resolves the issue for me.

@rbuckton
Copy link
Member

rbuckton commented Jul 8, 2020

This was fixed by #38808.

@rbuckton rbuckton closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status. Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

No branches or pull requests

5 participants