@salesforce/lightning-types
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Salesforce Lightning Types

Public type definitions for packages exposed on the Salesforce Lightning platform.

Installation

First, install the package using your preferred package manager.

npm install @salesforce/lightning-types
# OR
yarn add @salesforce/lightning-types

Next, import the package once, from any TypeScript file in your project. For example, if you have a types directory, you may create a file called salesforce.d.ts.

// types/salesforce.d.ts
import "@salesforce/lightning-types";

Lastly, ensure that the file with the import is included in your tsconfig.json.

{
  "compilerOptions": {
    // ...
  },
  "include": ["src", "types"],
}

Now you can import Salesforce Lightning types!

import LightningInput from "lightning/input";

Installing with LWC

@salesforce/lightning-types does not provide types for the lwc package directly, but instead specifies the package as a peer dependency. This allows you to control which version of lwc you are using. However, not all package managers automatically install peer dependencies; you may need to specify the lwc dependency explicitly.

npm install @salesforce/lightning-types lwc
# OR
yarn add @salesforce/lightning-types lwc

List of Modules

Type definitions for the following modules are included in this package.

Module Description
@salesforce/client/formFactor Access the form factor of the hardware the browser is running on.
@salesforce/community/basePath Get the section of the site’s URL that comes after the domain.
@salesforce/community/Id Get the ID of the network part of the site for eg., import the ID to pass as a parameter to an API.
@salesforce/site/activeLanguages The list of active languages in your Experience Builder site.
@salesforce/site/Id Get the current Experience Builder site Id.
@salesforce/user/Id Get the current user's ID.
@salesforce/user/isGuest Identify whether the current user is a guest or not.
lightning/industriesEducationPublicApi The lightning/industriesEducationPublicApi module includes APIs to create Constituent Role and update Benefit Assignment records.
lightning/logger Logs the event data from the component.
lightning/mobileCapabilities Mobile capabilities are JavaScript APIs that make mobile hardware and platform (operating system) features available in JavaScript. They require access to device hardware, platform APIs, or both. Mobile capability APIs are available only when a Lightning web component runs in a supported mobile app on a mobile device.

Bug Reports

This package solely contains TypeScript type definitions; it is not responsible for the behavior of the APIs it documents. If you encounter any issues, you may post on Salesforce Stack Exchange or open a Salesforce case.

Security

Please report any security issue to security@salesforce.com as soon as it is discovered. This library limits its runtime dependencies in order to reduce the total cost of ownership as much as can be, but all consumers should remain vigilant and have their security stakeholders review all third-party products (3PP) like this one and their dependencies.

License

All rights reserved. See the license in LICENSE.txt for details.

Package Sidebar

Install

npm i @salesforce/lightning-types

Weekly Downloads

1,215

Version

0.2.1

License

SEE LICENSE IN LICENSE.txt

Unpacked Size

76.6 kB

Total Files

23

Last publish

Collaborators

  • lwc-admin
  • dme722
  • nolanlawson
  • ire-npm-team-user
  • jburnie
  • abirchfieldsfdc
  • dlouvton
  • mobify
  • jmsjtu
  • jasonschroeder-sfdc
  • packagellama
  • maward
  • danielshox
  • duane.chew
  • dferro
  • jcourtner
  • jye-sf
  • adirasanam
  • hkii
  • iamaziz
  • dbreese-salesforce
  • ashokrudraraju
  • dhersam
  • demianbrecht
  • mbettio
  • damilareolowoniyi
  • mmadialagan
  • mjrust
  • salesforce-releases
  • kevinv11n
  • byao
  • pmdartus
  • ekashida
  • ravi.jayaramappa
  • apapko
  • jleen-sfdc
  • jqian
  • cwallsf
  • dhagberg-sf
  • khawkins
  • amphro
  • jodarove
  • sfdctaka
  • fernomac
  • jimjag
  • ivarley
  • jbartolotta-sfdc