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

Potentially missing FieldSet type #389

Open
sheindel opened this issue Oct 20, 2023 · 1 comment · May be fixed by #390 or grepdemos/airtable.js#3
Open

Potentially missing FieldSet type #389

sheindel opened this issue Oct 20, 2023 · 1 comment · May be fixed by #390 or grepdemos/airtable.js#3

Comments

@sheindel
Copy link

sheindel commented Oct 20, 2023

It looks like a Lookup field can have the following types

array of (numbers | strings | booleans | any)

Which would correlate to

Array<string | boolean | number | any>

or possibly

Array<string | boolean | number | Record<string, unknown>>

export interface FieldSet {
[key: string]:
| undefined
| string
| number
| boolean
| Collaborator
| ReadonlyArray<Collaborator>
| ReadonlyArray<string>
| ReadonlyArray<Attachment>;
}

@jsep
Copy link

jsep commented Nov 3, 2023

I can confirm that this is an issue with the FieldSet type.
The workaround I've found until the #390 is merged is to re-declare the type in a d.ts file for example global.d.ts which is included in the tsconfig.ts

declare module "airtable/lib/field_set" {
	export interface FieldSet {
		[key: string]:
			| string
			| number
			| boolean
			| Collaborator
			| readonly Collaborator[]
			| readonly string[]
			| readonly Attachment[]
			| readonly boolean[];
	}
}

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