GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Compile error using TypeScript "ReturnType" · Issue #24499 · angular/angular

Compile error using TypeScript "ReturnType" #24499

New issue
Copy link
New issue
Copy link
Closed
Closed
Compile error using TypeScript "ReturnType"#24499
Copy link

Description

@jmagaram
jmagaram
opened on Jun 14, 2018
Issue body actions

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

Create a brand new Angular app. Open in VS Code. Compiles and works fine. Add the following legal TypeScript to a new .ts file in the app folder.

const f = () => 'abc';
type T = ReturnType<typeof f>;

Run npm build. Error I receive is `error TS2304: Cannot find name 'ReturnType'. Works fine in an old create-react-app project. The VS Code editor is happy with the code (no red squigglies) but the build process isn't. The status bar shows using TypeScript 2.91.

Expected behavior

No build error.

Minimal reproduction of the problem with instructions

ng new ang-app
cd ang-app
ng serve --open

VS Code 1.24
Open folder ang-app
Run build task - no problems

In the app folder, add a file rt.ts with code as shown above
npm build
Error as described above

What is the motivation / use case for changing the behavior?

ReturnType is useful for generating strongly-typed actions (like Redux) with less boilerplate.

Environment


Angular version: 6.03 


Browser:
n/a
 
For Tooling issues:
- Node version: 5.60
- Platform:  Windows 10
- VS Code 1.24

Others:

Reacted by Eric Martinez

Activity

  1. jmagaram commented on Jun 14, 2018

    @jmagaram
    jmagaram
    on Jun 14, 2018
    Author
    More actions

    Did npm install -g typescript and then tsc --version and it shows 2.9.2. Restarted VS Code. Same problem. In package.json I set the devDependency of TypeScript to 2.9.2. Restarted VS Code. Same problem. Also tried this...

    let s: NonNullable = 7;

    And get the same error. Cannot find name 'NonNullable'. These are all part of conditional types

  2. jmagaram commented on Jun 14, 2018

    @jmagaram
    jmagaram
    on Jun 14, 2018
    Author
    More actions

    I think the features I want are part of TypeScript 2.8. I have installed the latest TypeScript as described above. Within VS Code when I'm editing a TypeScript file I see in the status bar below 2.9.2. If I click on it I get a choice of whether to use VS Code's version 2.9.2 or the workspace version 2.7.2, which is in the node/modules folder. I've chosen the more recent version.

  3. jmagaram commented on Jun 14, 2018

    @jmagaram
    jmagaram
    on Jun 14, 2018
    Author
    More actions

    Just found this StackOverflow comment

    If you want to use TS 2.8 you need to use cli version 6.1.0-beta.0

    Reacted by Rob Ede
  4. jmagaram commented on Jun 14, 2018

    @jmagaram
    jmagaram
    on Jun 14, 2018
    Author
    More actions

    Duplicate of #23779

  5. jmagaram
    closed this as completedon Jun 14, 2018
  6. angular-automatic-lock-bot commented on Sep 14, 2019

    @angular-automatic-lock-bot
    angular-automatic-lock-botBot
    on Sep 14, 2019
    More actions

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. angular-automatic-lock-bot
    locked and limited conversation to collaborators on Sep 14, 2019
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.