Skip to content

Typescript build error when using package #120

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

Closed
jbellos opened this issue Jan 21, 2025 · 5 comments
Closed

Typescript build error when using package #120

jbellos opened this issue Jan 21, 2025 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@jbellos
Copy link

jbellos commented Jan 21, 2025

npm install @duckdb/[email protected]
using typescript 4.6.4

create a new class:

import { DuckDBInstance } from '@duckdb/node-api';

export class DuckDbPostalAddressRepository {
    private _instance?: DuckDBInstance;

    private async _setupDataSource(): Promise<void> {
        if (!this._instance) {
            this._instance = await DuckDBInstance.create(':memory:');
        }
    }
}

compile with npm run tsc

../node_modules/@duckdb/node-api/lib/DuckDBLogicalType.d.ts:16:9 - error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
  Type 'undefined' is not assignable to type 'string'.

16     get alias(): string | undefined;
           ~~~~~


Found 1 error in ../node_modules/@duckdb/node-api/lib/DuckDBLogicalType.d.ts:16

If you need my tsconfig file let me know.

@jbellos
Copy link
Author

jbellos commented Jan 22, 2025

Image

Changing this to get alias(): string; fixes the build issue, but I've no idea if that's what you want to do here :)

@jraymakers
Copy link
Contributor

I believe this restriction was lifted in TypeScript 5.1. Can you upgrade, or do you need to stick with an older version for some reason?

@jraymakers jraymakers self-assigned this Jan 22, 2025
@jraymakers
Copy link
Contributor

It's easy to support this case by expanding the accepted types for this function, so I'm doing that: #121

@jraymakers
Copy link
Contributor

The fix is merged and will go out the next time I do a release. Since DuckDB 1.2.0 is coming out very soon, I'll likely wait for that.

@jraymakers
Copy link
Contributor

Fixed in 1.1.3-alpha.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants