Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enonic-types

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enonic-types - npm Package Compare versions

Comparing version 0.3.11 to 0.3.12

6

package.json
{
"name": "enonic-types",
"sideEffects": false,
"version": "0.3.11",
"version": "0.3.12",
"description": "TypeScript types for Enonic XP",

@@ -27,4 +27,4 @@ "typings": "index.d.ts",

"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"eslint": "^8.6.0",

@@ -31,0 +31,0 @@ "eslint-config-prettier": "^8.3.0",

@@ -69,3 +69,40 @@ # TypeScript types for Enonic XP

4. `content` is of the type `Content<Article> | null`, so we have to do a null check before proceeding.
# Using vanilla JavaScript
If your project is using vanilla JavaScript, you can still get the benefit of code completion when using libraries.
This is even better if you are using [JsDoc to add types to your code](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html).
All you have to do is the following:
1. Configure *./tsconfig.json* as described above
2. Add a file: *./src/main/resources/types.ts* with the following content:
```typescript
type LibMap = import('enonic-types/libs').EnonicLibraryMap;
declare const require: <K extends keyof LibMap | string = string>(
path: K
) => K extends keyof LibMap ? LibMap[K] : unknown;
declare const resolve: (
path: string
) => import('enonic-types/thymeleaf').ResourceKey;
declare const app: {
name: string;
version: string;
config: { [key: string]: string };
};
declare const log: {
info: (...args: unknown[]) => void;
warning: (...args: unknown[]) => void;
error: (...args: unknown[]) => void;
};
declare const __: {
newBean: (bean: string) => unknown;
toNativeObject: <A = unknown>(beanResult: A) => A;
};
```
## Using `__non_webpack_require__`

@@ -72,0 +109,0 @@

@@ -137,5 +137,7 @@ declare module "*/lib/turbo-streams" {

*/
interface GetWebSocketUrlParams {
service: string;
}
type GetWebSocketUrlParams = Omit<import("/lib/xp/portal").ServiceUrlParams, "params"> & {
params?: {
groupId?: string;
};
};
}

@@ -142,0 +144,0 @@ const turboStreamsLib: turboStreamsLib.TurboStreamsLibrary;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc