Skip to content
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

TypeScript 4.3.1-rc error on resolved store name #222

Closed
brunnerh opened this issue May 15, 2021 · 3 comments
Closed

TypeScript 4.3.1-rc error on resolved store name #222

brunnerh opened this issue May 15, 2021 · 3 comments
Assignees

Comments

@brunnerh
Copy link

brunnerh commented May 15, 2021

Not sure if this is worth looking into as TS 4.3 has not been released yet, but using this version causes store name parameters to not be resolved correctly.

E.g.

import { openDB, DBSchema } from 'idb';

async function doDatabaseStuff()
{
	const db = await openDB<DB>('documents', 1, {
		upgrade(db, oldVersion, newVersion, transaction)
		{
			// Argument of type 'string' is not assignable to parameter of type 'never'. ts(2345)
			db.createObjectStore('documents', { keyPath: 'id' });
		}
	});
}

interface DB extends DBSchema
{
	documents: {
		value: {
			id: string,
			text: string,
		}
		key: string,
	},
};

package.json:

{
	"dependencies": {
		"idb": "6.0.0",
		"typescript": "4.3.1-rc"
	}
}

[Issue Repository]

@brunnerh brunnerh changed the title TypeScript 4.4 error on resolved store name TypeScript 4.3.1-rc error on resolved store name May 15, 2021
@jakearchibald
Copy link
Owner

Cheers. I can recreate this issue.

@jakearchibald jakearchibald self-assigned this May 18, 2021
@jakearchibald
Copy link
Owner

Fixed in e3c76a5, and published as 6.1.0. Thanks for catching this!

I think this might be a TypeScript bug (and I'll file an issue with them), but I'm happy with the change here.

@jakearchibald
Copy link
Owner

Filed microsoft/TypeScript#44143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants