added typing for codegen.macro (#36409)

This commit is contained in:
charlee 2019-07-03 11:29:34 -04:00 committed by Ben Lichtman
parent d0c0725ae4
commit 71f8b36c56
4 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import codegen = require('codegen.macro');
const eg1: string = codegen`module.exports = "'hello world'"`;
const eg2: number = codegen`module.exports = "42"`;
const eg3: { [key: string]: string } = codegen`module.exports = "({ hello: 'world' })"`;

7
types/codegen.macro/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
// Type definitions for codegen.macro 3.0
// Project: https://github.com/kentcdodds/codegen.macro
// Definitions by: Charlee Li <https://github.com/charlee>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function codegen(strings: TemplateStringsArray, ...values: any[]): any;
export = codegen;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"codegen.macro-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }