Skip to content
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

type export issue #47374

Closed
waitingsong opened this issue Apr 7, 2018 · 3 comments
Closed

type export issue #47374

waitingsong opened this issue Apr 7, 2018 · 3 comments
Assignees
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@waitingsong
Copy link

Issue Type: Bug

tsconfig.json

{
  "compilerOptions": {
    "alwaysStrict": true,           /* Parse in strict mode and emit "use strict" for each source file. */
    "declaration": true,            /* Generates corresponding '.d.ts' file. */
    "module": "commonjs",           /* 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */
    "strict": true,                 /* Enable all strict type-checking options. */
    "target": "ES2017",              /* 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
    "types" : ["node"]
  }
}

package.json

{
  "name": "",
  "version": "1.0.0",
  "description": "",
  "private": true,
  "scripts": {},
  "dependencies": {},
  "devDependencies": {
    "@types/node": "^7.0.12",
    "tslib": "^1.9.0",
    "typescript": "^2.8.1"
  },
  "engines": {
    "node": ">=8.9.0"
  }
} 

config/config.default.ts

export interface Config {
  keys: string
  news: {
    pageSize: number;
  };
}

export type PowerPartial<T> = {
  [U in keyof T]?: T[U] extends {}
  ? PowerPartial<T[U]>
  : T[U]
}

// for config.{env}.ts
export type DefaultConfig = PowerPartial<Config>;

config.local.ts

import { DefaultConfig } from './config.default';

export default () => {
  const config: DefaultConfig = {};

  config.sourceUrl = 'foo'
  config.news = {
    pageSize: 20,
  };

  return config;
}; 

got error:

config/config.local.ts(3,1): error TS4082: Default export of the module has or is using private name 'PowerPartial'.
config/config.local.ts(6,10): error TS2339: Property 'sourceUrl' does not exist on type 'PowerPartial<Config>'.
11:06:36 - Compilation complete. Watching for file changes.

if change to `"declaration": false,``` , then issue gone.
any suggestion ?

VS Code version: Code 1.21.1 (79b44aa, 2018-03-14T14:46:47.128Z)
OS version: Windows_NT x64 6.1.7601

System Info
Item Value
CPUs Intel(R) Core(TM) i5 CPU 760 @ 2.80GHz (4 x 2809)
Memory (System) 15.97GB (4.32GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe E:\project\tt\ts\config\config.local.ts
Screen Reader no
VM 67%
Extensions: none Reproduces without extensions
@vscodebot vscodebot bot assigned mjbvz Apr 7, 2018
@vscodebot vscodebot bot added the typescript Typescript support issues label Apr 7, 2018
@waitingsong
Copy link
Author

If change

export interface Config {
  keys: string
  news: {
    pageSize: number;
  };
}

without sub object news, then issue gone

export interface Config {
  keys: string
 // news: {
 //   pageSize: number;
 //  };
}

@waitingsong
Copy link
Author

maybe bug of TypeScript ?

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 9, 2018

This issue was moved to microsoft/TypeScript#23280

@mjbvz mjbvz closed this as completed Apr 9, 2018
@mjbvz mjbvz added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Apr 9, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators May 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants