Skip to content

Commit

Permalink
Add "" around keys in the TypeScript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellocurto committed Sep 23, 2024
1 parent f041e8b commit 33b0a51
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,15 @@ export async function getBaseSchema({
apiKey: string;
baseId: string;
}): Promise<AirtableBaseSchema> {
const response = await fetch(`https://api.airtable.com/v0/meta/bases/${baseId}/tables`, {
method: 'GET',
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
const response = await fetch(
`https://api.airtable.com/v0/meta/bases/${baseId}/tables`,
{
method: 'GET',
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
);

if (!response.ok) {
throw new Error(`Error fetching base schema: ${response.statusText}`);
Expand Down Expand Up @@ -476,7 +479,7 @@ export async function generateTypeScriptDefinitions({
let typeDefinitions = `type ${table.name}Fields = {\n`;

table.fields.forEach((field) => {
typeDefinitions += ` ${field.name}?: ${mapAirtableTypeToTypeScript(
typeDefinitions += ` "${field.name}"?: ${mapAirtableTypeToTypeScript(
field.type
)};\n`;
});
Expand Down

0 comments on commit 33b0a51

Please sign in to comment.