IssueRaiser

export access modifiers

<!-- 🚨 STOP 🚨 𝗦𝗧𝗒𝗣 🚨 𝑺𝑻𝑢𝑷 🚨 Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please help us by doing the following steps before logging an issue: * Search: https://github.com/Microsoft/TypeScript/search?type=Issues * Read the FAQ, especially the "Common Feature Requests" section: https://github.com/Microsoft/TypeScript/wiki/FAQ --> ## Search Terms <!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily --> export access modifiers public protected private Related: #321 ## Suggestion <!-- A summary of what you'd like to see added or changed --> Allow adding `public`, `protected` and `private` access modifiers to export statements. This would limit where the data can be imported from. ### Access Modifiers #### `private` Other file in the same directory scope have access to the export. #### `protected` Other file in the same directory scope or a nested scope have access to the export. #### `public` (default) Current behavior - Can be access from anywhere. ## Use Cases Most useful for large projects - allows modules to limit where things they expose are used. ## Examples Given the following director structure: ```txt . β”œβ”€β”€ module β”‚ β”œβ”€β”€ submodule β”‚ β”‚ └── index.ts β”‚ β”œβ”€β”€ file.ts β”‚ └── index.ts └── index.ts ``` ```ts // module/file.ts public export const foo = "hello"; protected export const bar = "

Posted by RebeccaStevens on Oct 29, 2020, 1:27 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

reliability (Software)

export access modifiers

RebeccaStevensOct 29, 2020, 1:27 AM

<!-- 🚨 STOP 🚨 𝗦𝗧𝗒𝗣 🚨 𝑺𝑻𝑢𝑷 🚨 Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please help us by doing the following steps before logging an issue: * Search: https://github.com/Microsoft/TypeScript/search?type=Issues * Read the FAQ, especially the "Common Feature Requests" section: https://github.com/Microsoft/TypeScript/wiki/FAQ --> ## Search Terms <!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily --> export access modifiers public protected private Related: #321 ## Suggestion <!-- A summary of what you'd like to see added or changed --> Allow adding `public`, `protected` and `private` access modifiers to export statements. This would limit where the data can be imported from. ### Access Modifiers #### `private` Other file in the same directory scope have access to the export. #### `protected` Other file in the same directory scope or a nested scope have access to the export. #### `public` (default) Current behavior - Can be access from anywhere. ## Use Cases Most useful for large projects - allows modules to limit where things they expose are used. ## Examples Given the following director structure: ```txt . β”œβ”€β”€ module β”‚ β”œβ”€β”€ submodule β”‚ β”‚ └── index.ts β”‚ β”œβ”€β”€ file.ts β”‚ └── index.ts └── index.ts ``` ```ts // module/file.ts public export const foo = "hello"; protected export const bar = "

Comments (0)

No comments yet. Start the discussion.

Comment on this issue