Skip to content

fix: Fix incorrect getSchemas type #219

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

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ You can generate schema types for your own workspace with [@ftrack/ts-schema-gen
Once generated, you can integrate them with @ftrack/api by passing them as a type variable:

```ts
import SchemaTypes from "./__generated__/schema.ts";
import { EntityTypeMap } from "./__generated__/schema.ts";
import { Session } from "@ftrack/api";

const session = new Session<SchemaTypes>(...);
const session = new Session<EntityTypeMap>(...);

// user will now be of type User
// and provide all available properties for its entity type.
Expand Down
2 changes: 1 addition & 1 deletion source/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export class Session<
* This is cached after the first call, and assumes that the schemas will not change during the session.
* @returns Promise with the API schemas for the session.
*/
async getSchemas(): Promise<Schema<TEntityTypeMap[keyof TEntityTypeMap]>[]> {
async getSchemas(): Promise<Schema<TEntityTypeMap>[]> {
if (!this.schemasPromise) {
this.schemasPromise = this.call<QuerySchemasResponse<TEntityTypeMap>>([
{ action: "query_schemas" },
Expand Down