Skip to content

Interactive init #10964

Closed
Closed

Description

@tinganho

I think --initcould be improved a lot if TypeScript provided an interactive init. People don't know TS flags at the beginning, so it is not wise to require them knowing the flags before creating a tsconfig.json file:

tsc --init
This utility will walk you through creating a tsconfig.json file.
It only covers the most common items, and tries to guess sensible defaults.
--
Which JS compilation target do you want to target?
target(default=es5, alt=es3,es6)? es5

--
Strict null checking provides null type checking capability. `null` and `undefined` will be types that are not assignable to all types anymore. They are only assignable to itself or `any` .
Turn on 'strictNullChecking' flag(default=yes, alt=no)?

--
No implicit any flag helps you from implicitly typing `anys` in parameters and local variables. With this flag only explicit `anys` will be allowed
Turn on 'noImplicitAny' flag(default=yes, alt=no)? yes

--
Is your project a NodeJS based project(default=no, alt=yes)? yes

Downloading types for NodeJS 
npm install @types/node --save
------
======> 13% 
Downloading @types/node
------

Activity

  1. aluanhaddad commented on Sep 17, 2016

    @aluanhaddad
    Contributor

    Great idea. This looks a lot like JSPM init. It could do clever things like ask what file your entry point will be called and if you respond index.js it would set "allowJs": true

  2. codefoster commented on Apr 21, 2018

    @codefoster

    I would prefer it be called more like npm. npm init initiates it interactively or npm init -y takes all of the defaults. If I want to change my defaults (in npm that's things like my name and my preferred license) then I modify (in the command line or in a text editor) my .npmrc file and those defaults are used every time I do npm init -y.
    Currently I use tsc --init and then reference a OneNote that I use to remind myself which configuration options I like to change.

  3. RyanCavanaugh commented on Jun 24, 2021

    @RyanCavanaugh
    Member

    Declining due to low feedback and lack of interest on our side in implementing. We're not really sure what kind of questions would get asked and we like that there's one place to put our "recommended" config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions