Skip to content

Multiple TypeScript errors when using package acebase #220

@Septh

Description

@Septh

This minimalist TypeScript code:

import { AceBase } from 'acebase'

ends up with TypeScript reporting 6 errors.

(expand to reveal screenshot, text-only version is below)

image

Stephan@Bombasse-III MINGW64 ~/Dev/zz_tests/acebase
$ tsc
node_modules/acebase/dist/types/storage/binary/index.d.ts:267:5 - error TS2416: Property 'getChildren' in type 'AceBaseStorage' is not assignable to the same property in base type 'Storage'.
  Type '(path: string, options?: { keyFilter?: string[] | number[] | undefined; tid?: string | number | undefined; async?: boolean | undefined; } | undefined) => { next(valueCallback: (child: BinaryNodeInfo) => boolean | void, useAsync?: boolean | undefined): Promise<...>; }' is not assignable to type '(path: string, options?: { keyFilter?: string[] | number[] | undefined; tid?: string | number | undefined; async?: boolean | undefined; } | undefined) => { next: (callback: (child: NodeInfo) => boolean | ... 1 more ... | Promise<...>) => Promise<...>; }'.
    Call signature return types '{ next(valueCallback: (child: BinaryNodeInfo) => boolean | void, useAsync?: boolean | undefined): Promise<boolean>; }' and '{ next: (callback: (child: NodeInfo) => boolean | void | Promise<boolean | void>) => Promise<boolean>; }' are incompatible.
      The types of 'next' are incompatible between these types.
        Types of parameters 'valueCallback' and 'callback' are incompatible.
          Type 'boolean | void | Promise<boolean | void>' is not assignable to type 'boolean | void'.
            Type 'Promise<boolean | void>' is not assignable to type 'boolean | void'.

267     getChildren(path: string, options?: {
        ~~~~~~~~~~~

node_modules/acebase/dist/types/storage/custom/index.d.ts:187:5 - error TS2416: Property 'getChildren' in type 'CustomStorage' is not assignable to the same property in base type 'Storage'.
  Type '(path: string, options?: { transaction?: CustomStorageTransaction | undefined; keyFilter?: string[] | number[] | undefined; } | undefined) => { next(valueCallback: (child: NodeInfo) => boolean): Promise<...>; }' is not assignable to type '(path: string, options?: { keyFilter?: string[] | number[] | undefined; tid?: string | number | undefined; async?: boolean | undefined; } | undefined) => { next: (callback: (child: NodeInfo) => boolean | ... 1 more ... | Promise<...>) => Promise<...>; }'.
    Call signature return types '{ next(valueCallback: (child: NodeInfo) => boolean): Promise<boolean>; }' and '{ next:(callback: (child: NodeInfo) => boolean | void | Promise<boolean | void>) => Promise<boolean>; }' are incompatible.
      The types of 'next' are incompatible between these types.
        Types of parameters 'valueCallback' and 'callback' are incompatible.
          Type 'boolean | void | Promise<boolean | void>' is not assignable to type 'boolean'.
            Type 'void' is not assignable to type 'boolean'.

187     getChildren(path: string, options?: {
        ~~~~~~~~~~~

node_modules/acebase/dist/types/storage/custom/local-storage/transaction.d.ts:23:5 - error TS2416: Property 'childrenOf' in type 'LocalStorageTransaction' is not assignable to the same property in base type 'CustomStorageTransaction'.
  Type '(path: string, include: { metadata?: boolean | undefined; value?: boolean | undefined; }, checkCallback: (path:string) => boolean, addCallback: (path: string, node: ICustomStorageNodeMetaData | ICustomStorageNode) => boolean) => Promise<...>' is not assignable to type '(path: string, include: { metadata: boolean; value: boolean; }, checkCallback: (childPath: string) => boolean, addCallback?: ((childPath: string, node?: ICustomStorageNodeMetaData | ICustomStorageNode| undefined) => boolean) | undefined) => Promise<...>'.
    Types of parameters 'addCallback' and 'addCallback' are incompatible.
      Type '((childPath: string, node?: ICustomStorageNodeMetaData | ICustomStorageNode | undefined) => boolean) | undefined' is not assignable to type '(path: string, node: ICustomStorageNodeMetaData | ICustomStorageNode) => boolean'.
        Type 'undefined' is not assignable to type '(path: string, node: ICustomStorageNodeMetaData | ICustomStorageNode) => boolean'.

23     childrenOf(path: string, include: {
       ~~~~~~~~~~

node_modules/acebase/dist/types/storage/custom/local-storage/transaction.d.ts:27:5 - error TS2416: Property 'descendantsOf' in type 'LocalStorageTransaction' is not assignable to the same property in base type 'CustomStorageTransaction'.
  Type '(path: string, include: { metadata?: boolean | undefined; value?: boolean | undefined; }, checkCallback: (path:string) => boolean, addCallback: (path: string, node: ICustomStorageNodeMetaData | ICustomStorageNode) => boolean) => Promise<...>' is not assignable to type '(path: string, include: { metadata: boolean; value: boolean; }, checkCallback: (descPath: string, metadata?: ICustomStorageNodeMetaData | undefined) => boolean, addCallback?: ((descPath: string, node?: ICustomStorageNodeMetaData | ... 1 more ... | undefined) => boolean) | undefined) => Promise<...>'.
    Types of parameters 'addCallback' and 'addCallback' are incompatible.
      Type '((descPath: string, node?: ICustomStorageNodeMetaData | ICustomStorageNode | undefined) => boolean) | undefined' is not assignable to type '(path: string, node: ICustomStorageNodeMetaData | ICustomStorageNode) => boolean'.
        Type 'undefined' is not assignable to type '(path: string, node: ICustomStorageNodeMetaData | ICustomStorageNode) => boolean'.

27     descendantsOf(path: string, include: {
       ~~~~~~~~~~~~~

node_modules/acebase/dist/types/storage/mssql/index.d.ts:138:5 - error TS2416: Property 'getChildren' in type 'MSSQLStorage' is not assignable to the same property in base type 'Storage'.
  Type '(path: string, options?: { keyFilter?: (string | number)[] | undefined; tid?: string | number | undefined; } | undefined) => { next(valueCallback: (child: MSSQLNodeInfo) => boolean): Promise<...>; }' is not assignable to type '(path: string, options?: { keyFilter?: string[] | number[] | undefined; tid?: string | number | undefined; async?: boolean |undefined; } | undefined) => { next: (callback: (child: NodeInfo) => boolean | ... 1 more ... | Promise<...>) => Promise<...>; }'.
    Call signature return types '{ next(valueCallback: (child: MSSQLNodeInfo) => boolean): Promise<boolean>; }' and '{ next: (callback: (child: NodeInfo) => boolean | void | Promise<boolean | void>) => Promise<boolean>; }' are incompatible.
      The types of 'next' are incompatible between these types.
        Types of parameters 'valueCallback' and 'callback' are incompatible.
          Type 'boolean | void | Promise<boolean | void>' is not assignable to type 'boolean'.

138     getChildren(path: string, options?: {
        ~~~~~~~~~~~

node_modules/acebase/dist/types/storage/sqlite/index.d.ts:70:5 - error TS2416: Property 'getChildren' in type 'SQLiteStorage' is not assignable to the same property in base type 'Storage'.
  Type '(path: string, options?: { keyFilter?: (string | number)[] | undefined; tid?: string | number | undefined; } | undefined) => { next(valueCallback: (child: SQLiteNodeInfo) => boolean): Promise<...>; }' is not assignable to type '(path: string, options?: { keyFilter?: string[] | number[] | undefined; tid?: string | number | undefined; async?: boolean | undefined; } | undefined) => { next: (callback: (child: NodeInfo) => boolean | ... 1 more ... | Promise<...>) => Promise<...>; }'.
    Call signature return types '{ next(valueCallback: (child: SQLiteNodeInfo) => boolean): Promise<boolean>; }' and '{next: (callback: (child: NodeInfo) => boolean | void | Promise<boolean | void>) => Promise<boolean>; }' are incompatible.
      The types of 'next' are incompatible between these types.
        Types of parameters 'valueCallback' and 'callback' are incompatible.
          Type 'boolean | void | Promise<boolean | void>' is not assignable to type 'boolean'.

70     getChildren(path: string, options?: {
       ~~~~~~~~~~~


Found 6 errors in 5 files.

Errors  Files
     1  node_modules/acebase/dist/types/storage/binary/index.d.ts:267
     1  node_modules/acebase/dist/types/storage/custom/index.d.ts:187
     2  node_modules/acebase/dist/types/storage/custom/local-storage/transaction.d.ts:23
     1  node_modules/acebase/dist/types/storage/mssql/index.d.ts:138
     1  node_modules/acebase/dist/types/storage/sqlite/index.d.ts:70

Stephan@Bombasse-III MINGW64 ~/Dev/zz_tests/acebase
$

AceBase 1.28.2, tested with both TypeScript 4.9.5 and 5.0.4 (note that I have "skipLibCheck": false in tconfig.json).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions