mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
Merge pull request #28119 from tyler-johnson/nunjucks-fixes
add missing typings for nunjucks
This commit is contained in:
Vendored
+13
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for nunjucks 3.0
|
||||
// Type definitions for nunjucks 3.1
|
||||
// Project: http://mozilla.github.io/nunjucks/
|
||||
// Definitions by: Ruben Slabbert <https://github.com/RubenSlabbert>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -95,6 +95,7 @@ export function installJinjaCompat(): void;
|
||||
export interface ILoader {
|
||||
async?: boolean;
|
||||
getSource(name: string): LoaderSource;
|
||||
getSource(name: string, callback: (err?: any, result?: LoaderSource) => void): void;
|
||||
extend?(extender: ILoader): ILoader;
|
||||
}
|
||||
|
||||
@@ -128,7 +129,7 @@ export class FileSystemLoader extends Loader implements ILoader {
|
||||
constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions);
|
||||
}
|
||||
|
||||
export class WebLoader implements ILoader {
|
||||
export class WebLoader extends Loader implements ILoader {
|
||||
constructor(baseUrl: string, opts?: any);
|
||||
getSource(name: string): LoaderSource;
|
||||
}
|
||||
@@ -137,3 +138,13 @@ export class PrecompiledLoader extends Loader implements ILoader {
|
||||
init(searchPaths: string[], opts: any): void;
|
||||
getSource(name: string): LoaderSource;
|
||||
}
|
||||
|
||||
export namespace runtime {
|
||||
class SafeString {
|
||||
constructor(val: string);
|
||||
val: string;
|
||||
length: number;
|
||||
valueOf(): string;
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,3 +52,5 @@ class MyLoader extends nunjucks.Loader implements nunjucks.ILoader {
|
||||
}
|
||||
|
||||
env = new nunjucks.Environment(new MyLoader());
|
||||
|
||||
new nunjucks.runtime.SafeString("an unsafe string");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": false
|
||||
"interface-name": false,
|
||||
"no-unnecessary-class": false // to allow SafeString class
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user