diff --git a/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts new file mode 100644 index 0000000000..c8adb26d1a --- /dev/null +++ b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts @@ -0,0 +1,5 @@ +import hbs from 'htmlbars-inline-precompile'; + +const likeThisDotRender = (s: string | string[]) => {}; + +likeThisDotRender(hbs`this is allowed`); diff --git a/types/htmlbars-inline-precompile/index.d.ts b/types/htmlbars-inline-precompile/index.d.ts new file mode 100644 index 0000000000..ab4bf9a1b7 --- /dev/null +++ b/types/htmlbars-inline-precompile/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for htmlbars-inline-precompile 1.0 +// Project: https://github.com/ember-cli/ember-cli-htmlbars-inline-precompile +// Definitions by: Chris Krycho +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// This is a bit of a funky one: it's from a [Babel plugin], but is exported for +// Ember applications as the module `"htmlbars-inline-precompile"`. It acts +// like a tagged string from the perspective of consumers, but is actually an +// AST transformation which generates a function as its output. That function in +// turn [generates a string or array of strings][output] to use with the Ember +// testing helper `this.render()`. +// +// [Babel plugin]: https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile#babel-plugin-htmlbars-inline-precompile- +// [output]: https://github.com/emberjs/ember-test-helpers/blob/77f9a53da9d8c19a85b3122788caadbcc59274c2/lib/ember-test-helpers/-legacy-overrides.js#L17-L42 + +export default function hbs(tagged: TemplateStringsArray): string | string[]; diff --git a/types/htmlbars-inline-precompile/tsconfig.json b/types/htmlbars-inline-precompile/tsconfig.json new file mode 100644 index 0000000000..32ad3d22fb --- /dev/null +++ b/types/htmlbars-inline-precompile/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "htmlbars-inline-precompile-tests.ts" + ] +} diff --git a/types/htmlbars-inline-precompile/tslint.json b/types/htmlbars-inline-precompile/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/htmlbars-inline-precompile/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }