# @structured-types/typescript-config

> Retrieve the configuration for a typescript file

Latest version **3.46.9** (published 2022-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @structured-types/typescript-config
pnpm add @structured-types/typescript-config
yarn add @structured-types/typescript-config
bun add @structured-types/typescript-config
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.46.9 |
| Published | 2022-05-11 |
| First published | 2021-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 54.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 82 |
| Author | Atanas Stoyanov |
| Maintainers | atanasster |
| Keywords | typescript |

## Links

- npm: https://www.npmjs.com/package/@structured-types/typescript-config
- Repository: https://github.com/ccontrols/component-controls
- Issues: https://github.com/ccontrols/component-controls/issues
- npm.io page: https://npm.io/package/@structured-types/typescript-config

## Dependencies (2)

- [deepmerge](https://npm.io/package/deepmerge.md) ^4.2.2
- [path-browserify](https://npm.io/package/path-browserify.md) ^1.0.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 3.46.9 (latest) — 2022-05-11
- 3.40.5 — 2022-01-05
- 3.40.0 — 2022-01-01
- 3.39.7 — 2021-12-17
- 3.39.6 — 2021-12-16
- 3.39.5 — 2021-12-16
- 3.39.4 — 2021-12-16
- 3.39.3 — 2021-12-16
- 3.37.1 — 2021-12-08
- 3.37.0 — 2021-12-06
- 3.36.0 — 2021-11-18
- 3.35.0 — 2021-11-07
- 3.32.0 — 2021-10-31
- 3.31.0 — 2021-10-25
- 3.25.0 — 2021-10-07
- … 8 more at https://npm.io/package/@structured-types/typescript-config/versions

## README

# Table of contents

-   [Overview](#overview)
-   [Installation](#installation)
-   [Getting started](#getting-started)
-   [API](#api)
    -   [TSConfigFS](#tsconfigfs)
    -   [TSConfigOptions](#tsconfigoptions)
    -   [getTypescriptConfig](#gettypescriptconfig)

# Overview

Retrieve the configuration for a typescript file.

# Installation

```bash
$ npm install @structured-types/typescript-config --save-dev
```

# Getting started

    import { getTypescriptConfig } from '@structured-types/typescript-config';
    import * as ts from 'typescript';

    const config = getTypescriptConfig('./tsfile.ts', {
      compilerOptions: {
        jsx: ts.JsxEmit.ReactJSX,
      }
    });

# API

<api-readme files="./src/index.ts"/>

<!-- START-API-README -->

## TSConfigFS

**`type`**

_defined in [@structured-types/typescript-config/misc/typescript-config/src/index.ts](https://github.com/ccontrols/component-controls/tree/master/misc/typescript-config/src/index.ts#L5)_

**properties**

| Name          | Type                                                                                  |
| ------------- | ------------------------------------------------------------------------------------- |
| `fileExists*` | **function** (<br />`filePath`\*: `string`<br />) => `Promise`&lt;`boolean`>          |
| `readFile*`   | **function** (<br />`filePath`\*: `string`<br />) => `Promise`&lt;(`string`, `null`)> |

## TSConfigOptions

**`type`**

Config parsing options

_defined in [@structured-types/typescript-config/misc/typescript-config/src/index.ts](https://github.com/ccontrols/component-controls/tree/master/misc/typescript-config/src/index.ts#L16)_

**properties**

| Name   | Type            | Description                                     |
| ------ | --------------- | ----------------------------------------------- |
| `json` | `boolean`       | keep json format of ts config                   |
| `host` | ts.CompilerHost | optional compiler host to use instead of ts.sys |

## getTypescriptConfig

**`function`**

Reads any typescript configuration files for a given file, including the extends references

_defined in [@structured-types/typescript-config/misc/typescript-config/src/index.ts](https://github.com/ccontrols/component-controls/tree/master/misc/typescript-config/src/index.ts#L33)_

**parameters**

| Name            | Type                                  | Description                                                                              |
| --------------- | ------------------------------------- | ---------------------------------------------------------------------------------------- |
| `filePath*`     | `string`                              | the full file path to the file                                                           |
| `defaultConfig` | ts.CompilerOptions                    | optional default configuration                                                           |
| `options`       | [`TSConfigOptions`](#tsconfigoptions) | Config parsing options                                                                   |
| `returns`       | `ts.CompilerOptions` \| `undefined`   | the typescript configuration for the file, or undefined if this is not a typescript file |

<!-- END-API-README -->

---
_Source: https://npm.io/package/@structured-types/typescript-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
