[react-scrollbar-size] Introduce type definitions (#38768)

This commit is contained in:
Alex Bukurov
2019-10-01 15:59:28 -07:00
committed by Ryan Cavanaugh
parent b899dec969
commit 47fc9ee659
4 changed files with 60 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for react-scrollbar-size 2.1
// Project: https://github.com/STORIS/react-scrollbar-size#readme
// Definitions by: Alex Bukurov <https://github.com/abukurov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export interface Measurement {
scrollbarWidth: number;
scrollbarHeight: number;
}
export interface ScrollbarSizeProps {
onLoad?: (measurement: Measurement) => void;
onChange?: (measurement: Measurement) => void;
}
export default class ScrollbarSize extends React.Component<ScrollbarSizeProps> {
}
@@ -0,0 +1,14 @@
import * as React from "react";
import ScrollbarSize from "react-scrollbar-size";
const elements = [
<ScrollbarSize/>,
<ScrollbarSize
onLoad={measurement => {
console.log(measurement.scrollbarWidth, measurement.scrollbarHeight);
}}
onChange={measurement => {
console.log(measurement.scrollbarWidth, measurement.scrollbarHeight);
}}
/>
];
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"jsx": "react",
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-scrollbar-size-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }