This library contains additional types for the Wx IDE (Integrated Development Environment). It adds several useful types that are not included in the default Wx IDE, and also allows you to create your own custom types.
To install this library, simply head over to the Extensions tab in the Wx IDE and search for "Wx types". or simply tap upload and copy this repo url into the box and then tap install.
Once the Wx types Extension is installed, you can add your own custom types by adding them in the UI.
Once installed, you can use the types in your Wx scripts by importing them. For example:
const editor: Editor = prop.monacoInstance // Assigns the correct editor type to the variable
const exampleProduct: Product = {
id: "prod_123",
name: "Classic T-Shirt",
description: "A comfortable cotton t-shirt available in multiple sizes.",
shortDescription: "Cotton t-shirt",
price: 19.99,
compareAtPrice: 24.99,
cost: 8.5,
sku: "TSHIRT-CLSC-001",
barcode: "123456789012",
trackQuantity: true,
quantity: 150,
weight: 0.25,
weightUnit: "kg",
category: "Clothing",
tags: ["tshirt", "cotton", "casual"],
status: "active",
vendor: "Acme Apparel",
productType: "Shirt",
images: [
"https://example.com/images/tshirt-front.jpg",
"https://example.com/images/tshirt-back.jpg",
],
variants: [
{
id: "var_001",
name: "Classic T-Shirt - Small / Red",
sku: "TSHIRT-CLSC-S-RED",
price: 19.99,
compareAtPrice: 24.99,
quantity: 50,
options: { size: "S", color: "Red" },
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
{
id: "var_002",
name: "Classic T-Shirt - Medium / Blue",
sku: "TSHIRT-CLSC-M-BLUE",
price: 19.99,
quantity: 100,
options: { size: "M", color: "Blue" },
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
],
seoTitle: "Buy Classic Cotton T-Shirt | Acme Apparel",
seoDescription: "Shop our classic cotton t-shirt, perfect for everyday wear.",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
slug: "products/classic-t-shirt"
};
console.log(exampleProduct);The following types are included in this library:
ProductProductVariantPluginAPIEndpointRegisteredPluginPluginMethod
export interface PluginAPIEndpoint {
registerPlugin: (namespace: string, methods: PluginMethod[], instance: any) => void
callPlugin: (namespace: string, methodName: string, ...args: any[]) => Promise<any>
awaitRegistration: (namespace: string) => Promise<RegisteredPlugin>
}export interface RegisteredPlugin {
namespace: string
methods: PluginMethod[]
instance: any
}export interface PluginMethod {
name: string
method: Function
description?: string
}You can view the types for the Product and ProductVariant interfaces in the Wx Ecommerce repository.
You do not need to import the types, as they are automatically imported when you install the Extension.
