Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Augmenting Cash with my own functions #380

Open
RobinRadic opened this issue Jun 26, 2021 · 1 comment
Open

Augmenting Cash with my own functions #380

RobinRadic opened this issue Jun 26, 2021 · 1 comment

Comments

@RobinRadic
Copy link

RobinRadic commented Jun 26, 2021

image

Unlike many other typescript libraries. Doing something like:

declare module 'cash-dom' {
    export interface Cash
        ensureClass(className, remove):Cash
    }
}

Doesn't work. Neither in the same .ts file, a seperate .d.ts file and with or without the export before the interface, in case that would.

Ofcourse, in the .d.ts file i'm adding

import 'cash-dom'
// repetition of previous code

How to augment Cash?

@fabiospampinato
Copy link
Owner

This worked for me when I wrote it, but I think at some point it stopped working.

I'll have to look more closely into it. Suggestions welcome.

@fabiospampinato fabiospampinato changed the title Agumenting Cash with my own functions Augmenting Cash with my own functions Apr 13, 2023
cyfung1031 added a commit to cyfung1031/jquery-cash that referenced this issue May 3, 2023
`[key: string]: Function;` is added to `Cash` such that fabiospampinato#380 can be resolved.

`ICashArray<HTMLElement>` is also added such that Cash can be array-like with HTMLElement results from `querySelectorAll`.
cyfung1031 added a commit to cyfung1031/jquery-cash that referenced this issue May 3, 2023
Added TypeScript support for $.fn

`[key: string]: Function;` is added to `Cash` such that fabiospampinato#380 can be resolved.

`ArrayLike<HTMLElement>` is also added such that Cash can be array-like with HTMLElement results from `querySelectorAll`.

The element array shall be the normal use for this script. If the array content is other type such as document, window, number, etc, for typescript users, they shall do `$(document)[0] as any as Document`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants