@types/nunjucks
Advanced tools
Comparing version 3.2.2 to 3.2.3
@@ -72,3 +72,3 @@ // Type definitions for nunjucks 3.2 | ||
constructor(loader?: ILoader | ILoader[] | null, opts?: ConfigureOptions); | ||
constructor(loader?: ILoaderAny | ILoaderAny[] | null, opts?: ConfigureOptions); | ||
render(name: string, context?: object): string; | ||
@@ -110,8 +110,21 @@ render(name: string, context?: object, callback?: TemplateCallback<string>): void; | ||
/** A synchronous or an asynchronous loader. */ | ||
export type ILoaderAny = ILoader | ILoaderAsync | WebLoader; | ||
// WebLoader is part of the union because it can be both sync or async depending | ||
// on its constructor arguments, which possibly could only be known on runtime. | ||
/** A synchronous loader. */ | ||
export interface ILoader { | ||
async?: boolean | undefined; | ||
getSource(name: string): LoaderSource; | ||
getSource(name: string, callback: Callback<Error, LoaderSource>): void; | ||
async?: false | undefined; | ||
getSource: (name: string) => LoaderSource; | ||
} | ||
/** An asynchronous loader. */ | ||
export interface ILoaderAsync { | ||
async: true; | ||
getSource: (name: string, callback: Callback<Error, LoaderSource>) => void; | ||
} | ||
// Needs both Loader and ILoader since nunjucks uses a custom object system | ||
@@ -124,3 +137,3 @@ // Object system is also responsible for the extend methods | ||
isRelative(filename: string): boolean; | ||
static extend<LoaderClass extends typeof Loader>(this: LoaderClass, toExtend: ILoader): LoaderClass; | ||
static extend<LoaderClass extends typeof Loader>(this: LoaderClass, toExtend: ILoaderAny): LoaderClass; | ||
} | ||
@@ -160,5 +173,7 @@ | ||
export class WebLoader extends Loader implements ILoader { | ||
export class WebLoader extends Loader { | ||
constructor(baseUrl?: string, opts?: WebLoaderOptions); | ||
getSource(name: string): LoaderSource; | ||
async: boolean; | ||
getSource: (name: string, callback: Callback<Error, LoaderSource>) => LoaderSource; | ||
} | ||
@@ -165,0 +180,0 @@ |
{ | ||
"name": "@types/nunjucks", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "TypeScript definitions for nunjucks", | ||
@@ -23,4 +23,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nunjucks", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "c224fdc662bf5566367648603abe1b58d00a1286c7d3a6d72543678080d788d3", | ||
"typeScriptVersion": "4.2" | ||
"typesPublisherContentHash": "5315fcdc5b6765e17d2cb24f97e86605b61bfcbf5daf013fe11a226314375e6c", | ||
"typeScriptVersion": "4.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Wed, 15 Feb 2023 06:32:35 GMT | ||
* Last updated: Thu, 29 Jun 2023 22:32:43 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9459
164