I have the following overloaded function: # ************************************************************************************** @overload def get_mount( name: Literal["SimulatedAltAzMountDeviceInterface"], params: SimulatedAltAzMountDeviceParameters, **extras: Any, ) -> SimulatedAltAzMountDeviceInterface: ... @overload def get_mount( name: Literal["BaseMountDeviceInterface"], params: BaseMountDeviceParameters, **extras: Any, ) -> BaseMountDeviceInterface: ... def get_mount( name, params, **extras: Any, ): """ Retrieve a mount factory by name from the MOUNT_FACTORY_REGISTRY. Raises: UnknownDeviceError: If the mount name is not found in the registry. """ if name == "SimulatedAltAzMountDeviceInterface": return SimulatedAltAzMountDeviceInterface(params=params, **extras) valid = ", ".join(sorted(MOUNT_FACTORY_REGISTRY)) raise UnknownDeviceError( f"Mount '{name}' not found in registry. Valid choices: {valid}" ) # ************************************************************************************** Yet when I call this as: mount = get_mount( name="SimulatedAltAzMountDeviceInterface", params={ ... } ) mount.connect() The typings in VS Code come back as: Somehow, even though the typesense seems to be working somewhat by correctly typing the params argument, the return type seems to fall back. What I have done wrong here ? Reproduction: Pyright playground Continue reading...