Skip to content

feat: generate type declarations #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ bower_components/

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
dist/src

# Grunt temporary storage
temp/
Expand Down
47 changes: 47 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# OS or Editor folders
._*
.cache
.DS_Store
.idea
.vs
.vscode
.project
.projectile
.settings
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
nbproject
Thumbs.db

# Node logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# grunt-contrib-sass cache
.sass-cache/

# Dependency directories
node_modules/
bower_components/

# Grunt temporary storage
temp/

# Jasmine SpecRunner
_SpecRunner.html

# Ignore compiled files
css/ghpages-materialize.css
bin/

# Ignore lock
yarn.lock

# Compiled docs
/docs/*.html
!/docs/fab-toolbar-demo.html
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"homepage": "https://materializecss.github.io/materialize/",
"version": "2.0.2-alpha",
"main": "dist/js/materialize.js",
"module": "src/index.ts",
"style": "dist/css/materialize.css",
"sass": "sass/materialize.scss",
"typings": "dist/src/index.d.ts",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -37,6 +39,7 @@
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@types/node": "^20.5.2",
"autoprefixer": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
Expand Down
2 changes: 1 addition & 1 deletion src/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Carousel extends Component<CarouselOptions> {
velocity: number;
frame: number;
timestamp: number;
ticker: NodeJS.Timer;
ticker: string | number | NodeJS.Timeout;
amplitude: number;
/** The index of the center carousel item. */
center: number = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/chips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class Chips extends Component<ChipsOptions> {
* @param el HTML element.
* @param options Component options.
*/
static init(el: HTMLElement, options?: Partial<ChipsOptions>): Chips;
static init(el: InitElements<MElement>, options?: Partial<ChipsOptions>): Chips;
/**
* Initializes instances of Chips.
* @param els HTML elements.
Expand Down
4 changes: 1 addition & 3 deletions src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,4 @@ export class M {
M.Tooltip.init(registry.Tooltip, {});
M.FloatingActionButton.init(registry.FloatingActionButton, {});
}
}

export default M;
}
26 changes: 26 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export * from './global';
export { Autocomplete } from './autocomplete';
export { FloatingActionButton } from './buttons';
export { Cards } from './cards';
export { Carousel } from './carousel';
export { CharacterCounter } from './characterCounter';
export { Chips } from './chips';
export { Collapsible } from './collapsible';
export { Datepicker } from './datepicker';
export { Dropdown } from './dropdown';
export { Forms } from './forms';
export { Materialbox } from './materialbox';
export { Modal } from './modal';
export { Parallax } from './parallax';
export { Pushpin } from './pushpin';
export { ScrollSpy } from './scrollspy';
export { FormSelect } from './select';
export { Sidenav } from './sidenav';
export { Slider } from './slider';
export { Tabs } from './tabs';
export { TapTarget } from './tapTarget';
export { Timepicker } from './timepicker';
export { Toast } from './toasts';
export { Tooltip } from './tooltip';
export { Waves } from './waves';
export { Range } from './range';
9 changes: 6 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"compilerOptions": {
//"outDir": "./bin/",
"outDir": "./dist",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "CommonJS",
"moduleResolution": "node",
"skipLibCheck": true,
"target": "ES6",
"target": "ES2017",
"esModuleInterop": true,
"resolveJsonModule": true,
"sourceMap": true
"sourceMap": true,
"composite": true,
"declaration": true,
"declarationMap": true,
},
"include": [
"test",
Expand Down