Generator-jhipster: @types/[email protected] breaks generated code for app/modules/login/login.tsx

Created on 30 Jan 2020  ·  1Comment  ·  Source: jhipster/generator-jhipster

Motivation for or Use Case

I am unable to generate new monolithic application any more due to change in @types/[email protected]

@types/[email protected] introduced a change that breaks the generated code for app/modules/login/login.tsx
``` diff -r node_modules/@types/history/index.d.ts ../otsc/2020/otsc/node_modules/@types/history/index.d.ts 52,55c52 < // The value type here is a "poor man's `unknown`". When these types support TypeScript < // 3.0+, we can replace this with `unknown`. < type PoorMansUnknown = {} | null | undefined; < export type LocationState = PoorMansUnknown; --- > export type LocationState = any;
##### **Reproduce the error**

generate a new monotlithic application using JHipster 6.6.0

##### **Related issues**

<!-- Has a similar issue been reported before? Please search both closed & open issues -->

##### **Suggest a Fix**
file: ```generator-jhipster/generators/client/templates/react/src/main/webapp/app/modules/login/login.tsx.ejs```
-const { from } = location.state || { from: { pathname: '/', search: location.search } }; +const { from } = location.state as unknown || { from: { pathname: '/', search: location.search } };
##### **JHipster Version(s)**

6.6.0 

##### **JHipster configuration**

INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator

##### **JHipster Version(s)**

[email protected] /Users/user/src/example └── [email protected] ``` ##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": “com.example.project,
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.6.0",
    "applicationType": "monolith",
    "baseName": “example”,
    "packageName": "com.example.project",
    "packageFolder": "com/example/project",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "no",
    "devDatabaseType": "no",
    "prodDatabaseType": "no",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "react",
    "clientTheme": "sandstone",
    "clientThemeVariant": "primary",
    "creationTimestamp": 1580343309923,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": ["en", "in"],
    "blueprints": []
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions


Environment and Tools

openjdk version "11.0.1" 2018-10-16 LTS
OpenJDK Runtime Environment Zulu11.2+3 (build 11.0.1+13-LTS)
OpenJDK 64-Bit Server VM Zulu11.2+3 (build 11.0.1+13-LTS, mixed mode)

git version 2.19.0

node: v12.10.0

npm: 6.11.3

yeoman: 3.1.1

Docker version 19.03.1, build 74b1e89

docker-compose version 1.24.1, build 4667896b

INFO! Congratulations, JHipster execution is complete!

Entity configuration(s) entityName.json files generated in the .jhipster directory

not relevant

Browsers and Operating System

MacOSX

  • [X] Checking this box is mandatory (this is just to show you read everything)
duplicate

Most helpful comment

This has already been fixed on master with:

const { from } = location.state as any || { from: { pathname: '/', search: location.search } };

>All comments

This has already been fixed on master with:

const { from } = location.state as any || { from: { pathname: '/', search: location.search } };
Was this page helpful?
0 / 5 - 0 ratings