Skip to content

Commit

Permalink
Single types file
Browse files Browse the repository at this point in the history
  • Loading branch information
jackocnr committed Jul 10, 2024
1 parent e193bec commit 46c3dcb
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 1,055 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function(grunt) {
// just images
grunt.registerTask('img', ['responsive_images:retina', 'exec:evenizer', 'responsive_images:regular', 'sprite', 'imagemin', 'generate-scss-metadata']);
// just javascript
grunt.registerTask('js', ['shell:eslint', 'shell:genTsDeclaration', 'shell:genReactTsDeclaration', 'shell:buildJs', 'replace', 'shell:buildReact', 'replace:removeImport']);
grunt.registerTask('js', ['shell:eslint', 'shell:genTsDeclaration', 'shell:buildJs', 'replace', 'shell:buildReact', 'replace:removeImport']);
// just react
grunt.registerTask('react', ['replace:reactWithUtils', 'shell:buildReact', 'replace:removeImport']);

Expand Down
44 changes: 44 additions & 0 deletions build/js/intlTelInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,28 @@ declare module "intl-tel-input" {
const intlTelInput: IntlTelInputInterface;
export default intlTelInput;
}
declare module "intl-tel-input/react" {
import intlTelInput from "intl-tel-input";
import { Iti, SomeOptions } from "intl-tel-input";
import React from "react";
export { intlTelInput };
type ItiProps = {
initialValue?: string;
onChangeNumber?: (number: string) => void;
onChangeCountry?: (country: string) => void;
onChangeValidity?: (valid: boolean) => void;
onChangeErrorCode?: (errorCode: number | null) => void;
usePreciseValidation?: boolean;
initOptions?: SomeOptions;
inputProps?: object;
};
export type IntlTelInputRef = {
getInstance: () => Iti | null;
getInput: () => HTMLInputElement | null;
};
const IntlTelInput: React.ForwardRefExoticComponent<ItiProps & React.RefAttributes<IntlTelInputRef>>;
export default IntlTelInput;
}
declare module "intl-tel-input/utils-compiled" {
export default utils;
const utils: any;
Expand All @@ -981,3 +1003,25 @@ declare module "intl-tel-input/intlTelInputWithUtils" {
import intlTelInput from "intl-tel-input";
export default intlTelInput;
}
declare module "intl-tel-input/reactWithUtils" {
import intlTelInput from "intl-tel-input/intlTelInputWithUtils";
import { Iti, SomeOptions } from "intl-tel-input";
import React from "react";
export { intlTelInput };
type ItiProps = {
initialValue?: string;
onChangeNumber?: (number: string) => void;
onChangeCountry?: (country: string) => void;
onChangeValidity?: (valid: boolean) => void;
onChangeErrorCode?: (errorCode: number | null) => void;
usePreciseValidation?: boolean;
initOptions?: SomeOptions;
inputProps?: object;
};
export type IntlTelInputRef = {
getInstance: () => Iti | null;
getInput: () => HTMLInputElement | null;
};
const IntlTelInput: React.ForwardRefExoticComponent<ItiProps & React.RefAttributes<IntlTelInputRef>>;
export default IntlTelInput;
}
3 changes: 0 additions & 3 deletions grunt/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ module.exports = function(grunt) {
genTsDeclaration: {
command: 'tsc --p tsconfig.json'
},
genReactTsDeclaration: {
command: 'tsc --p react/tsconfig.json'
},
eslint: {
command: 'eslint src/js/intl-tel-input.ts'
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@
"./data": "./build/js/data.js",
"./utils": "./build/js/utils.js",
"./react": {
"types": "./react/build/IntlTelInput.d.ts",
"types": "./build/js/intlTelInput.d.ts",
"require": "./react/build/IntlTelInput.cjs",
"default": "./react/build/IntlTelInput.js"
},
"./reactWithUtils": {
"types": "./react/build/IntlTelInput.d.ts",
"types": "./build/js/intlTelInput.d.ts",
"require": "./react/build/IntlTelInputWithUtils.cjs",
"default": "./react/build/IntlTelInputWithUtils.js"
},
Expand All @@ -133,7 +133,7 @@
"build/js/intlTelInput.d.ts"
],
"react": [
"react/build/IntlTelInput.d.ts"
"./build/js/intlTelInput.d.ts"
]
}
},
Expand Down
Loading

0 comments on commit 46c3dcb

Please sign in to comment.