3.46.9 • Published 2 years ago

@structured-types/typescript-config v3.46.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Table of contents

Overview

Retrieve the configuration for a typescript file.

Installation

$ 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

TSConfigFS

type

defined in @structured-types/typescript-config/misc/typescript-config/src/index.ts

properties

NameType
fileExists*function (filePath*: string) => Promise<boolean>
readFile*function (filePath*: string) => Promise<(string, null)>

TSConfigOptions

type

Config parsing options

defined in @structured-types/typescript-config/misc/typescript-config/src/index.ts

properties

NameTypeDescription
jsonbooleankeep json format of ts config
hostts.CompilerHostoptional 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

parameters

NameTypeDescription
filePath*stringthe full file path to the file
defaultConfigts.CompilerOptionsoptional default configuration
optionsTSConfigOptionsConfig parsing options
returnsts.CompilerOptions | undefinedthe typescript configuration for the file, or undefined if this is not a typescript file
3.46.9

2 years ago

3.40.0

2 years ago

3.40.5

2 years ago

3.39.5

2 years ago

3.39.6

2 years ago

3.39.7

2 years ago

3.36.0

2 years ago

3.37.0

2 years ago

3.37.1

2 years ago

3.39.3

2 years ago

3.39.4

2 years ago

3.35.0

3 years ago

3.32.0

3 years ago

3.31.0

3 years ago

3.25.0

3 years ago

3.24.3

3 years ago

3.24.2

3 years ago

3.17.0

3 years ago

3.16.5

3 years ago

3.16.2

3 years ago

3.16.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago