Skip to content

Return type of debounced function not preserved #15

@todor-a

Description

@todor-a

TanStack Pacer version

0.2.0

Framework/Library version

React 19

Describe the bug and the steps to reproduce it

import { debounce } from '@tanstack/react-pacer';
import debounceLodash from 'lodash.debounce';

const withTanstack = debounce(
    () => 1,
    { wait: 500 }
);

const withLodash = debounceLodash(
    () => 2,
    500
);

withTanstack;
// ^? const withTanstack: () => void

withLodash;
// ^ const withLodash: DebouncedFunc<() => number>

Is this intentional?

Playground.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgEwKYCMIFcB2BjVOAXzgDMoIQ4ByAARgEMcBnRvAawHopUG8YAtGD6oo1ANwAoUJFgoM2fKgAyEZA2YALMhSrUANmo2aAdGky4CEyZLwQW8AO7AYmgCpNWfdnAC88iyUACkk4MLgggEo-AD5EUPDEnhgsKBw4AEYpRKIAGgSwpEcGFwAuOABWAAYq4klIqVt7VjhnV1V1LT8AxQIO4xDEqNj4xKTUFLS4ACZs8LyCypr6xrb3TzZ2KU5OOAA9AH4bNf6tbd29oA

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

yes

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions