Skip to content

arangojs requires "dom" lib in tsconfig, even when used in Node.js #818

@Yogu

Description

@Yogu

If you import arangojs in a typescript project without including the dom lib, you currently get three errors

node_modules/arangojs/databases.d.ts:2284:43 - error TS2304: Cannot find name 'File'.

2284     installService(mount: string, source: File | Blob | string, options?: services.InstallServiceOptions): Promise<services.ServiceDescription>;
                                               ~~~~

node_modules/arangojs/databases.d.ts:2318:43 - error TS2304: Cannot find name 'File'.

2318     replaceService(mount: string, source: File | Blob | string, options?: services.ReplaceServiceOptions): Promise<services.ServiceDescription>;
                                               ~~~~

node_modules/arangojs/databases.d.ts:2352:43 - error TS2304: Cannot find name 'File'.

2352     upgradeService(mount: string, source: File | Blob | string, options?: services.UpgradeServiceOptions): Promise<services.ServiceDescription>;

Adding dom to the lib fixes this, but this has a drawback: You no longer get a type error if you accidentally use a symbol that's available in browsers but not in Node.js. For server-side development, it's better not to include "dom" to catch these errors.

I think the File | can just be removed. as File extends Blob: https://github.com/microsoft/TypeScript/blob/717d05cc2d528deb51cf7785bdd71891935d19a8/src/lib/dom.generated.d.ts#L8734

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions