From 78e0b7fb159bf9b87e0beb77d73b95622b4084ef Mon Sep 17 00:00:00 2001 From: Andy Dvorak Date: Tue, 12 Feb 2019 18:41:15 -0800 Subject: [PATCH] WIP: Add `types.ts` for public exports --- packages/mdc-auto-init/index.ts | 35 ++------------------- packages/mdc-auto-init/types.ts | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 33 deletions(-) create mode 100644 packages/mdc-auto-init/types.ts diff --git a/packages/mdc-auto-init/index.ts b/packages/mdc-auto-init/index.ts index 58596397677..1e708437e46 100644 --- a/packages/mdc-auto-init/index.ts +++ b/packages/mdc-auto-init/index.ts @@ -25,39 +25,7 @@ import {MDCComponent} from '@material/base/component'; import {MDCFoundation} from '@material/base/foundation'; - -export type MDCAutoInitKey = ( - 'MDCCheckbox' | - 'MDCChip' | - 'MDCChipSet' | - 'MDCDialog' | - 'MDCDrawer' | - 'MDCFloatingLabel' | - 'MDCFormField' | - 'MDCGridList' | - 'MDCIconButtonToggle' | - 'MDCIconToggle' | - 'MDCLineRipple' | - 'MDCLinearProgress' | - 'MDCList' | - 'MDCMenu' | - 'MDCMenuSurface' | - 'MDCNotchedOutline' | - 'MDCRadio' | - 'MDCRipple' | - 'MDCSelect' | - 'MDCSlider' | - 'MDCSnackbar' | - 'MDCSwitch' | - 'MDCTabBar' | - 'MDCTextField' | - 'MDCToolbar' | - 'MDCTopAppBar' -); - -export type MDCAutoInitElement = HTMLElement & { - [K in MDCAutoInitKey]?: string; -}; +import {MDCAutoInitElement, MDCAutoInitKey} from './types'; interface ComponentClass { // tslint:disable-next-line:no-any a component can pass in anything it needs to the constructor @@ -152,3 +120,4 @@ mdcAutoInit.deregisterAll = function() { }; export {mdcAutoInit as default, mdcAutoInit}; +export * from './types'; diff --git a/packages/mdc-auto-init/types.ts b/packages/mdc-auto-init/types.ts new file mode 100644 index 00000000000..b8164a35e92 --- /dev/null +++ b/packages/mdc-auto-init/types.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright 2019 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +export type MDCAutoInitKey = ( + 'MDCCheckbox' | + 'MDCChip' | + 'MDCChipSet' | + 'MDCDialog' | + 'MDCDrawer' | + 'MDCFloatingLabel' | + 'MDCFormField' | + 'MDCGridList' | + 'MDCIconButtonToggle' | + 'MDCIconToggle' | + 'MDCLineRipple' | + 'MDCLinearProgress' | + 'MDCList' | + 'MDCMenu' | + 'MDCMenuSurface' | + 'MDCNotchedOutline' | + 'MDCRadio' | + 'MDCRipple' | + 'MDCSelect' | + 'MDCSlider' | + 'MDCSnackbar' | + 'MDCSwitch' | + 'MDCTabBar' | + 'MDCTextField' | + 'MDCToolbar' | + 'MDCTopAppBar' +); + +export type MDCAutoInitElement = HTMLElement & { + [K in MDCAutoInitKey]?: string; +};