-
Notifications
You must be signed in to change notification settings - Fork 585
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
Object is not a constructor on Typescript import * from "realm" #1226
Comments
@CacaoRick did you try any of the tricks in https://realm.io/docs/javascript/latest/#missing-realm-constructor |
Thanks @kneth Here is my import Realm from "realm"
import * as RealmTypes from "realm"
const Meter: RealmTypes.ObjectSchema = {
// ...
}
const RecordData: RealmTypes.ObjectSchema = {
// ...
}
const Photo: RealmTypes.ObjectSchema = {
// ...
}
const realm: RealmTypes = new Realm({ schema: [Meter, RecordData, Photo] })
export default realm Now it can be intelligence, but still show error |
@CacaoRick Thanks for clarifying. Friday I was playing with some TypeScript but did see the issue. We have to investigate a bit more. |
@CacaoRick Is your issue related to #884? |
I'm work in android. |
@CacaoRick could you please add a config in "allowSyntheticDefaultImports": true |
With import * as Realm from "realm" App will show red screen and display error: Change import to: import Realm from "realm" App work fine, but vscode will not intelligence and tslint show error
Nothing change. |
What version of your Realm types ?
Works fine for me. |
|
Sorry my Now import Realm from "realm" |
@CacaoRick Not sure how to interpret you. Does it work for you? |
Yes allowSyntheticDefaultImports is work. |
Version:
When use:
Will show error in red screen:
Change import to this type is no problem:
But lose type intelligence and get ts error:
Similar problems in stackoverflow
Cannot open Realm using typescript 2.4.1 + react native 0.46.1 because Realm is not a constructor
Thanks
The text was updated successfully, but these errors were encountered: