From 63cb83efaff90030108171a5fd5cdf10efae209e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 8 Aug 2017 19:41:28 -0400 Subject: [PATCH 1/5] Add htmlbars-inline-precompile definition. --- .../htmlbars-inline-precompile-tests.ts | 3 +++ types/htmlbars-inline-precompile/index.d.ts | 13 +++++++++++ .../htmlbars-inline-precompile/tsconfig.json | 22 +++++++++++++++++++ types/htmlbars-inline-precompile/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts create mode 100644 types/htmlbars-inline-precompile/index.d.ts create mode 100644 types/htmlbars-inline-precompile/tsconfig.json create mode 100644 types/htmlbars-inline-precompile/tslint.json 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..1fa13cd72f --- /dev/null +++ b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts @@ -0,0 +1,3 @@ +import hbs from 'htmlbars-inline-precompile'; + +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..f8bf17f3ea --- /dev/null +++ b/types/htmlbars-inline-precompile/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for htmlbars-inline-precompile 1.0 +// Project: 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-incline-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. +// +// [Babel plugin]: https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile#babel-plugin-htmlbars-inline-precompile- + +export default function hbs(tagged: TemplateStringsArray): () => {}; 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" } From 0527bc3489bd1a4f1e33de059690f1b3551a25dd Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 8 Aug 2017 20:18:00 -0400 Subject: [PATCH 2/5] Fix typo in htmlbars-inline-precompile comments. --- types/htmlbars-inline-precompile/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/htmlbars-inline-precompile/index.d.ts b/types/htmlbars-inline-precompile/index.d.ts index f8bf17f3ea..31e21b2576 100644 --- a/types/htmlbars-inline-precompile/index.d.ts +++ b/types/htmlbars-inline-precompile/index.d.ts @@ -4,7 +4,7 @@ // 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-incline-precompile"`. It acts +// 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. // From 66f2c7e249c6c7b2734247ab7a32747dfaf6e86e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 8 Aug 2017 20:56:08 -0400 Subject: [PATCH 3/5] Update htmlbars-inline-precompile given Ember `this.render()`. --- .../htmlbars-inline-precompile-tests.ts | 4 +++- types/htmlbars-inline-precompile/index.d.ts | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts index 1fa13cd72f..3a8d722db6 100644 --- a/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts +++ b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts @@ -1,3 +1,5 @@ import hbs from 'htmlbars-inline-precompile'; -hbs`this is allowed`; +const likeThisDotRender = (s: string | Array) => {}; + +likeThisDotRender(hbs`this is allowed`); diff --git a/types/htmlbars-inline-precompile/index.d.ts b/types/htmlbars-inline-precompile/index.d.ts index 31e21b2576..db03d2fad1 100644 --- a/types/htmlbars-inline-precompile/index.d.ts +++ b/types/htmlbars-inline-precompile/index.d.ts @@ -6,8 +6,11 @@ // 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. +// 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): () => {}; +export default function hbs(tagged: TemplateStringsArray): string | Array; From 503c81ae213b63712bec94fc07c0977667cdddf2 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 8 Aug 2017 20:59:01 -0400 Subject: [PATCH 4/5] Fix array lint in htmlbars-inline-precompile. --- .../htmlbars-inline-precompile-tests.ts | 2 +- types/htmlbars-inline-precompile/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts index 3a8d722db6..c8adb26d1a 100644 --- a/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts +++ b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts @@ -1,5 +1,5 @@ import hbs from 'htmlbars-inline-precompile'; -const likeThisDotRender = (s: string | Array) => {}; +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 index db03d2fad1..21bbe63545 100644 --- a/types/htmlbars-inline-precompile/index.d.ts +++ b/types/htmlbars-inline-precompile/index.d.ts @@ -13,4 +13,4 @@ // [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 | Array; +export default function hbs(tagged: TemplateStringsArray): string | string[]; From b102312ac99faed18dde95f5b5cca898625398d4 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 9 Aug 2017 13:41:47 -0400 Subject: [PATCH 5/5] Change project to URL for htmlbars-inline-precompile. --- types/htmlbars-inline-precompile/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/htmlbars-inline-precompile/index.d.ts b/types/htmlbars-inline-precompile/index.d.ts index 21bbe63545..ab4bf9a1b7 100644 --- a/types/htmlbars-inline-precompile/index.d.ts +++ b/types/htmlbars-inline-precompile/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for htmlbars-inline-precompile 1.0 -// Project: ember-cli-htmlbars-inline-precompile +// Project: https://github.com/ember-cli/ember-cli-htmlbars-inline-precompile // Definitions by: Chris Krycho // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped