Add type definition for domelementtype (#33854)

* Added new types for domelementtype

* Updating PULL_REQUEST_TEMPLATE.md

* Revert changes to .github/PULL_REQUEST_TEMPLATE.md
This commit is contained in:
Johan Davidsson
2019-03-13 16:53:11 -07:00
committed by Wesley Wigham
parent 145ceda256
commit 813999bd2b
4 changed files with 82 additions and 0 deletions
@@ -0,0 +1,12 @@
import { DomElementType } from "domelementtype";
console.log(DomElementType.Text === 'text');
console.log(DomElementType.Directive === 'directive');
console.log(DomElementType.Comment === 'comment');
console.log(DomElementType.Script === 'script');
console.log(DomElementType.Style === 'style');
console.log(DomElementType.Tag === 'tag');
console.log(DomElementType.CDATA === 'cdata');
console.log(DomElementType.Doctype === 'doctype');
console.log(DomElementType.isTag({ type: DomElementType.Tag }));
console.log(DomElementType.isTag({ type: DomElementType.Doctype }));
+45
View File
@@ -0,0 +1,45 @@
// Type definitions for domelementtype 1.3
// Project: https://github.com/fb55/domelementtype#readme
// Definitions by: Johan Davidsson <https://github.com/johandavidson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export namespace DomElementType {
/***
* Text
*/
const Text = "text";
/***
* <? ... ?>
*/
const Directive = "directive";
/***
* <!-- ... -->
*/
const Comment = "comment";
/***
* <script> tags
*/
const Script = "script";
/***
* <style> tags
*/
const Style = "style";
/***
* Any tag
*/
const Tag = "tag";
/***
* <![CDATA[ ... ]]>
*/
const CDATA = "cdata";
/***
* <!DOCTYPE ... >
*/
const Doctype = "doctype";
/***
* Checks whether element object is a tag
*/
function isTag(elem: { type: string}): boolean;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"domelementtype-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }