README.md (5259B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2019 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # Type Declarations 22 23 [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] --> 24 25 > TypeScript type declarations for stdlib. 26 27 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 28 29 <section class="intro"> 30 31 </section> 32 33 <!-- /.intro --> 34 35 <!-- Package usage documentation. --> 36 37 <section class="installation"> 38 39 ## Installation 40 41 ```bash 42 npm install @stdlib/types 43 ``` 44 45 </section> 46 47 <section class="usage"> 48 49 ## Usage 50 51 ```typescript 52 /// <reference types="@stdlib/types"/> 53 54 import { ArrayLike } from '@stdlib/types/array'; 55 56 function sum( x: ArrayLike<number> ): number { 57 let s = 0.0; 58 for ( let i = 0; i < x.length; i++ ) { 59 s += x[ i ]; 60 } 61 return s; 62 } 63 ``` 64 65 Type declarations are organized as modules. For example, to use iterator type declarations, 66 67 ```typescript 68 /// <reference types="@stdlib/types"/> 69 70 import { Iterator } from '@stdlib/types/iter'; 71 72 function sum( iter: Iterator ): number { 73 let s = 0.0; 74 while ( true ) { 75 let v = iter.next(); 76 if ( v.done ) { 77 break; 78 } 79 s += v.value; 80 } 81 return s; 82 } 83 ``` 84 85 For the complete list of declared modules, see the `index.d.ts` type declaration file. 86 87 </section> 88 89 <!-- /.usage --> 90 91 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 92 93 <section class="notes"> 94 95 ## Notes 96 97 - In order to use included TypeScript declarations, configure your `tsconfig.json` file accordingly. For example, 98 99 ```text 100 { 101 "compilerOptions": { 102 ... 103 "typeRoots": [ "./path/to/@stdlib/types" ], 104 ... 105 }, 106 ... 107 } 108 ``` 109 110 </section> 111 112 <!-- /.notes --> 113 114 <!-- Package usage examples. --> 115 116 <section class="examples"> 117 118 </section> 119 120 <!-- /.examples --> 121 122 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 123 124 <section class="references"> 125 126 </section> 127 128 <!-- /.references --> 129 130 <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> 131 132 <section class="related"> 133 134 </section> 135 136 <!-- /.related --> 137 138 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 139 140 141 <section class="main-repo" > 142 143 * * * 144 145 ## Notice 146 147 This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. 148 149 For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. 150 151 #### Community 152 153 [![Chat][chat-image]][chat-url] 154 155 --- 156 157 ## License 158 159 See [LICENSE][stdlib-license]. 160 161 162 ## Copyright 163 164 Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. 165 166 </section> 167 168 <!-- /.stdlib --> 169 170 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 171 172 <section class="links"> 173 174 [npm-image]: http://img.shields.io/npm/v/@stdlib/types.svg 175 [npm-url]: https://npmjs.org/package/@stdlib/types 176 177 [test-image]: https://github.com/stdlib-js/types/actions/workflows/test.yml/badge.svg 178 [test-url]: https://github.com/stdlib-js/types/actions/workflows/test.yml 179 180 [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/types/main.svg 181 [coverage-url]: https://codecov.io/github/stdlib-js/types?branch=main 182 183 <!-- 184 185 [dependencies-image]: https://img.shields.io/david/stdlib-js/types.svg 186 [dependencies-url]: https://david-dm.org/stdlib-js/types/main 187 188 --> 189 190 [umd]: https://github.com/umdjs/umd 191 [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules 192 193 [deno-url]: https://github.com/stdlib-js/types/tree/deno 194 [umd-url]: https://github.com/stdlib-js/types/tree/umd 195 [esm-url]: https://github.com/stdlib-js/types/tree/esm 196 197 [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg 198 [chat-url]: https://gitter.im/stdlib-js/stdlib/ 199 200 [stdlib]: https://github.com/stdlib-js/stdlib 201 202 [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors 203 204 [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/types/main/LICENSE 205 206 </section> 207 208 <!-- /.links -->