mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added initial types for react-gtm-module (#35620)
* Added types for react-gtm-module * Fixed some tslint issues
This commit is contained in:
parent
2f577f967c
commit
c0a7ca952f
42
types/react-gtm-module/index.d.ts
vendored
Normal file
42
types/react-gtm-module/index.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Type definitions for react-gtm-module 2.0
|
||||
// Project: https://github.com/alinemorelli/react-gtm
|
||||
// Definitions by: Marc Veens <https://github.com/marcveens>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare const TagManager: {
|
||||
dataLayer: (dataLayerArgs: DataLayerArgs) => void;
|
||||
initialize: (tagManagerArgs: TagManagerArgs) => void;
|
||||
};
|
||||
|
||||
export interface TagManagerArgs extends DataLayerArgs {
|
||||
/**
|
||||
* GTM id, must be something like GTM-000000.
|
||||
*/
|
||||
gtmId: string;
|
||||
/**
|
||||
* Additional events such as 'gtm.start': new Date().getTime(),event:'gtm.js'.
|
||||
*/
|
||||
events?: object;
|
||||
/**
|
||||
* Used to set environments.
|
||||
*/
|
||||
auth?: string;
|
||||
/**
|
||||
* Used to set environments, something like env-00.
|
||||
*/
|
||||
preview?: string;
|
||||
}
|
||||
|
||||
export interface DataLayerArgs {
|
||||
/**
|
||||
* Object that contains all of the information that you want to pass to Google Tag Manager.
|
||||
*/
|
||||
dataLayer?: object;
|
||||
/**
|
||||
* Custom name for dataLayer object.
|
||||
*/
|
||||
dataLayerName?: string;
|
||||
}
|
||||
|
||||
export default TagManager;
|
||||
19
types/react-gtm-module/react-gtm-module-tests.tsx
Normal file
19
types/react-gtm-module/react-gtm-module-tests.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import TagManager from 'react-gtm-module';
|
||||
|
||||
TagManager.initialize({
|
||||
gtmId: 'GTM-000000'
|
||||
});
|
||||
|
||||
TagManager.initialize({
|
||||
gtmId: 'GTM-000000',
|
||||
events: {},
|
||||
auth: '',
|
||||
preview: '',
|
||||
dataLayer: {},
|
||||
dataLayerName: ''
|
||||
});
|
||||
|
||||
TagManager.dataLayer({
|
||||
dataLayer: {},
|
||||
dataLayerName: ''
|
||||
});
|
||||
24
types/react-gtm-module/tsconfig.json
Normal file
24
types/react-gtm-module/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-gtm-module-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-gtm-module/tslint.json
Normal file
1
types/react-gtm-module/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user