How can I import types from a .d.ts file in a .js file with the same name

I’m writing JavaScript code and want type safety with TypeSript via JSDoc.

Because it’s just nicer to write types in TypeScript I wanted to put the type definitions in a .d.ts file right next to my .js file:

// person.d.ts
export type Person = {
  name: string;
}
// person.js

/** @type {import("./person").Person} */
let person;

person = {
  name2: "sdf", // <-- this should error, but does not
};

The issue is, that this does seem to break the TypeScript checker.

If I rename person.d.ts to foo.d.ts and import ./foo instead, it works.

What is strange, is that TypeScript seems to see and understand the type, it just doesn’t properly interpret it:

Screenshot of VSCode, showing that the type Person is imported properly

Am I doing something wrong?