OneStore LWC Wire Adapter Types
npm install @conduit-client/lwc-typesThis package provides duplicated definitions of LWC wire adapter types without requiring a dependency on the LWC module itself.
The types in this package are compatible with the LWC wire service and can be used to implement wire adapters that work with LWC components, while avoiding the need to import from the lwc module directly.
- WireAdapter - Interface that all wire adapters must implement
- WireAdapterConstructor - Constructor interface for wire adapters
- WireConfigValue - Base type for wire configuration values
- WireContextValue - Context value passed to wire adapters
- WireDataCallback - Callback function that wire adapters use to emit data
``typescript
import type {
WireAdapter,
WireAdapterConstructor,
WireConfigValue,
WireDataCallback,
} from '@conduit-client/lwc-types';
// Use these types to implement wire adapters without depending on 'lwc'
class MyWireAdapter implements WireAdapter {
constructor(private callback: WireDataCallback) {}
connect(): void {
// Implementation
}
disconnect(): void {
// Implementation
}
update(config: WireConfigValue): void {
// Implementation
}
}
`
These types are designed to be compatible with the LWC wire service and match the interfaces used by the LWC framework. They can be used as drop-in replacements for the corresponding types from the lwc` module.