Object is not a constructor on Typescript import * from "realm"
See original GitHub issueVersion:
- react-native: 0.47.1
- realm: 1.10.3
When use:
import * as Realm from "realm"
new Realm({
schema: [{ name: 'Dog', properties: { name: 'string' } }]
})
// or
Realm.open({
schema: [{ name: 'Dog', properties: { name: 'string' } }]
})
.then((realm) => {...})
Will show error in red screen:
Object is not a constructor (evaluating 'new Realm({
schema: [{ name: 'Dog', properties: { name: 'string' } }]
})')
// or
Object is not a constructor (evaluating 'new _this(config)')
Change import to this type is no problem:
import Realm from "realm"
But lose type intelligence and get ts error:
Module ''realm'' has no default export.
Similar problems in stackoverflow Cannot open Realm using typescript 2.4.1 + react native 0.46.1 because Realm is not a constructor
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Cannot open Realm using typescript 2.4.1 + react native 0.46 ...
using typescript 2.4.1 and react native 0.46.1. Error I am receiving depending on how I import: TypeError: Realm is not a constructor.
Read more >Object is not a constructor on Typescript import * from "realm"
Version: react-native: 0.47.1; realm: 1.10.3. When use: import * as Realm from "realm" new Realm({ schema: [{ name: 'Dog', properties: { name: 'string'...
Read more >Getting Type Error Is Not A Constructor In Realm With React ...
This JavaScript exception is not a constructor that occurs if code tries to use an object or a Cause of Error: Somewhere the...
Read more >Class extends value # is not a constructor or null in Svelte App ...
import * as Realm from 'realm-web' I have the following error : Uncaught TypeError: Class extends value # is not a constructor or...
Read more >TypeError: "X" is not a constructor in JavaScript | bobbyhadz
TypeError : "X" is not a constructor in JavaScript # · Note that arrow functions cannot be used as constructors. · Always make...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@CacaoRick could you please add a config in
tsconfig.json@CacaoRick Not sure how to interpret you. Does it work for you?