#Don't understand the behavior of my intelliSense

3 messages · Page 1 of 1 (latest)

random pewter
#

I am using kysely-codegen library in order to generate types from the kysely library I am using.
I am using vs code if it matters what editor I use.

Do anyone have any suspicion on what the issue could be?

export const AssignmentOnCharacter = extendType({
  type: "Character",
  definition(t) {
    t.field("assignment", {
      type: Assignment,
      resolve: async (character, _, __) => {
        const characterAssignment = await getCharacterAssignment(character.id);

        return characterAssignment ? { id: characterAssignment. } : null; // no intellisense and characterAssignment is type any.
      },
    });
  },
});
export const AssignmentOnCharacter = extendType({
  type: "Character",
  definition(t) {
    t.field("assignment", {
      type: Assignment,
      resolve: async (character, _, __) => {
        const characterAssignment = await getCharacterAssignment(character.id);

        return characterAssignment ? { id: characterAssignment.assignmentId } : null; // assignmentId is type string and characterAssignment is of type "AllSelection<From<DB, "characterAssignment">, "characterAssignment">"
      },
    });
  },
});
sage notch
#

I can't try it for myself, but it looks like you're hitting the limits of what typescript can infer

#

if you split out your lambda functions and give them concrete types, instead of inferring them from extendType you may have better intellisense