@conduit-client/lwc-types
v3.5.0
Published
OneStore LWC Wire Adapter Types
Readme
-client/lwc-types
This package provides duplicated definitions of LWC wire adapter types without requiring a dependency on the LWC module itself.
Purpose
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.
Exported Types
WireAdapter- Interface that all wire adapters must implementWireAdapterConstructor- Constructor interface for wire adaptersWireConfigValue- Base type for wire configuration valuesWireContextValue- Context value passed to wire adaptersWireDataCallback- Callback function that wire adapters use to emit data
Usage
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
}
}Compatibility
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.
