-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module: "system" and outFile generates wrong module names #15951
Comments
I first thought it was a problem with JSPM jspm/jspm-cli#2275 but it's really a mix of outFile and module "system" from Typescript |
Does |
no, it's unrelated from each other
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"noEmitOnError": true,
"sourceMap": false,
"declaration": true,
"listEmittedFiles": true,
"preserveConstEnums": true
},
"exclude": [
"test.ts"
]
}
both are npm linked to my |
The reason I ask is that the name |
it has .js files, like I said, it has exported consts objects like such: // file is data.ts
export interface Statistics {
number: number;
name: string;
}
export interface LatLng {
lat: number;
lng: number;
accuracy?: number;
}
export type MaritalStatus = 'solteiro' | 'casado' | 'divorciado' | 'viuvo' | 'separado';
export const MaritalStatusTypes: Record<MaritalStatus, string> = {
casado: 'Casado',
divorciado: 'Divorciado',
separado: 'Separado',
solteiro: 'Solteiro',
viuvo: 'Viúvo'
} compiled to // file is data.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MaritalStatusTypes = {
casado: 'Casado',
divorciado: 'Divorciado',
separado: 'Separado',
solteiro: 'Solteiro',
viuvo: 'Viúvo'
}; I decided to put the typings and consts in that file because I use it in 3 distinct react frontends and a react native android app. |
I see, I was just put off by the name of the package. Also, I tried to reproduce but I couldn't. |
looks somewhat like #15876 I'll try to make a minimal repro this is my main project that has cim-typings and cim-shared-ui this is cim-typings: and this is cim-shared-ui: |
I just looked over this again and I think it is a bug in TypeScript because module specifiers are never supposed to be rewritten. Having said that, I couldn't reproduce the bug. |
is there at least any workaround for this? the side-by-side .d.ts generation really mess this up |
still happening in 2.5.0-dev |
TypeScript Version: 2.4.0-dev.20170519
Code
this Typescript code (on the main project)
generates
which is wrong. "../../cim-shared-ui" should be "cim-shared-ui", because it's a
npm linked
package. not sure if the problem is the link itself, because I have this, and works correctly, which is also from the main project:tsconfig.json as follows:
Expected behavior:
module: "system" should output dependencies as authored
Actual behavior:
TS is trying to do something funny with the paths, and it's inconsistent with other npm linked packages. The only difference between the two is that
cim-typings
is acommonjs
module, andcim-shared-ui
is asystem
moduleThe text was updated successfully, but these errors were encountered: