TypeScript mapped type value according to the key

Is it possible to have a type dependent on the key of a card?

For example;

type Thing = {
type: T
}

type ThingMap = {
    [K in T["type"]]: T
}

interface A {
type A ",
foo: boolean,
}

interface B {
type: "B",
}


// This compiles.
const card: ThingMap = {
A: {type: "A", foo: true},
B: {type: "B"},
}

// But that also compiles, whereas it should not.
const card: ThingMap = {
A: {type: "A", foo: true},
B: {type: "A", foo: true},
}