Typescript 4.9 (released Nov 15, 2022) makes this easy with the satisfies keyword.
In summary, it validates the types, but still keeps the specific type for inference.
type PageDef = {url: string}
const pages = {
home: { url: '/' }, // works!
about: { url: '/about' }, // works!
bad: { asdf: true } // error!
} satisfies Record<string, PageDef>
pages.home // works!
pages.about // works!
pages.nonexistent // error!