mirror of
https://github.com/appy-one/acebase.git
synced 2026-05-24 22:01:13 -06:00
[GH-ISSUE #145] Property 'ref' does not exist on type 'AceBase'. #81
Labels
No labels
IndexedDB
browser
bug
dependencies
documentation
duplicate
enhancement
feature request
indexes
indexes
invalid
pull-request
query
question
transaction logging
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase#81
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Tulipesz on GitHub (Aug 28, 2022).
Original GitHub issue: https://github.com/appy-one/acebase/issues/145
Hi!
I'm building a project with electron + typescript but the only types that appear for me are "ready" and "close".
Strange that the lib supports typing, I don't know what's going on.
The only way to get around the error is to add
// @ts-expect-errorbefore the line, but it doesn't seem like the right thing to do.
Temporarily:
Thx for the project and i appreciate any help.
@appy-one commented on GitHub (Aug 29, 2022):
Where are you importing
AceBasefrom?@Tulipesz commented on GitHub (Aug 29, 2022):
import { AceBase } from 'acebase'@appy-one commented on GitHub (Aug 29, 2022):
That looks ok. I tried reproducing today by creating a basic Electron app with TypeScript and AceBase, but everything worked as expected so there must be something else wrong in your project. Did you install acebase througn npm/yarn? And which version are you using?
@Tulipesz commented on GitHub (Aug 29, 2022):
Installed through yarn:
yarn add acebaseMy package.json dependencies:

I don't really bother with problems specific to my projects, but this is very strange to me since the whole acebase project is typed.
@Tulipesz commented on GitHub (Aug 29, 2022):
Inside module typing:


@appy-one commented on GitHub (Aug 29, 2022):
That's very strange! Can you try opening up
acebase-core/package.jsonandacebase-core/types/index.d.tsto see if that changes anything?@Tulipesz commented on GitHub (Aug 29, 2022):
I think the problem is in tsconfig.json, acebase does not create its typing in the

@typesfolder of node_modules.My "typeRoots" in tsconfig.json:
My

node_modules/@types:In the acebase-core folder all types are inside the "types" folder, how does the acebase module know that it has to get the types from this folder? By default, typescript looks for folders with @types when not specified:
https://www.typescriptlang.org/tsconfig#typeRoots
@appy-one commented on GitHub (Aug 29, 2022):
Why are you using
typeRoots? Each package that has typings has atypesentry in itspackage.jsonfile. If it doesn't, you'd need to install a@types/[packagename]dependency for it (when available). Bothacebaseandacebase-corehave their types location specified in theirpackage.jsonso there's no need to install anything else, or to manually specify other locations. Maybe you should try commenting out / removing thetypeRootsentry in yourtsconfig.jsonand see what happens?@Tulipesz commented on GitHub (Aug 30, 2022):
Thanks a lot for the help @appy-one ! And thanks for the explanation of the
typesentry inpackage.json, I didn't know that.The problem was in my
tsconfig.jsoneven but in themoduleResolutionentry. As I created my project through a template (https://github.com/Devtography/electron-react-typescript-webpack-boilerplate), it already came with thetypeRootssetted (but it works with it set anyway), the problem is that themoduleResolutioncame set as"Node16"and according to this discussion:https://github.com/microsoft/TypeScript/issues/49160#issuecomment-1137482639
some libs are breaking when the
"moduleResolution": "Node16"and inpackage.jsonhas theexportsentry (to be able to support cjs and esm in the same package). I just changed themoduleResolutionentry in mytsconfig.jsonto"Node"and everything is working perfectly.Again thanks a lot for the help!
@appy-one commented on GitHub (Aug 30, 2022):
Thanks for your research @Tulipesz! I'm now also generating
index.d.tsfiles into the CommonJS and ESM distribution folders that simply export all types from the right location. I've published the changes withacebase-corev1.22.0. After updating (reinstallacebasedependency), you should be able to use Node16 module resolution without issues!