npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nolikein/typed-alpinejs

v2.0.5

Published

Helpers usefull to create a new AlpineJs component with Livewire 3

Readme

TypeScript Helpers for AlpineJs and Livewire 3

Allows you to use the power of TypeScript when creating components with AlpineJs and Livewire 3.

Upgrade from 1.X to 2.X

Now all your "LivewireMethods" interfaces should be a Record<string, (...args: any) => any> instead of Record<string, any>.

This means your code pass from:

interface LivewireMethods {
    open: ({ state: boolean })
}

To:

interface LivewireMethods extends LivewireMethodsRecord {
    open: (state: boolean) => ({ state: boolean })
}

// OR

type LivewireMethods = {
    open: (state: boolean) => ({ state: boolean })
}

! Please take care about extending your LivewireData with LivewireDataRecord:

interface LivewireData extends LivewireDataRecord {
    open: boolean
}
// OR

type LivewireData = {
    open: boolean
}

In order to keep the type safety of your methods parameters and return types.

Installation

npm i @nolikein/typed-alpinejs

Usage

AlpineJs component only

As a basic example, let us try to create a Dropdown component.

Dropdown.ts

import { createAlpineComponent } from "@nolikein/typed-alpinejs";
import { AlpineData } from "./interface/Dropdown";

export default (
    // Component parameters...

) => createAlpineComponent<AlpineData>({
    // Component properties ...
    open: false,

    /**
     * Initialize the component
     */
    init() {
        //
    },

    toggle(): void {
        this.open = !this.open;
    },
});

All our component data are stored here.

interface/Dropdown.ts

export interface AlpineData {
    open: boolean
    toggle(): void
};

All the interfaces used by the component should be stored here.

index.ts

import Dropdown from "./Dropdown";

Alpine.data('Dropdown', Dropdown);

This is the main file where you import all your components.

AlpineJs with Livewire 3

Dropdown.ts

import { createAlpineLivewireComponent } from "@nolikein/typed-alpinejs";
import { AlpineData, LivewireData, LivewireMethods } from "./interface/Dropdown";

export default (
    // Component parameters...

) => createAlpineLivewireComponent<AlpineData, LivewireData, LivewireMethods>({
    // Component properties ...
    open: false,

    /**
     * Initialize the component
     */
    init() {
        //
    },

    toggle(): void {
        this.open = !this.open;
    },
});

All our component data are stored here.

interface/Dropdown.ts

export interface AlpineData {
    open: boolean
    toggle(): void
};

export interface LivewireData extends LivewireDataRecord {
    // Here should be all your Livewire component public properties
    // By example:
    open: boolean
};

export interface LivewireMethods extends LivewireMethodsRecord {
    // Here should be all your Livewire component public methods
    // By example, here is a method to "toggle" the Livewire component value.
    // This method return the boolean value equivalent to its "open" public property.
    toggle(): boolean
};

All the interfaces used by the component should be stored here.

index.ts

import Dropdown from "./Dropdown";

Alpine.data('Dropdown', Dropdown);

This is the main file where you import all your components.

Dependencies

This package depends on @nolikein/types-livewire3 to provide TypeScript types for Livewire 3 components.

Contribute

Feel free to open issues or make pull requests on Gitlab.

Licence

MIT