Skip to content

TSConfig Italian translation: added files #16

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

Merged
merged 5 commits into from
Jan 28, 2021
Merged

Conversation

DeltaPy
Copy link
Contributor

@DeltaPy DeltaPy commented Jan 27, 2021

Files:

  • allowUnreachableCode.md
  • allowUmdGlobalAccess.md
  • SyntheticDefaultImports.md

@ghost
Copy link

ghost commented Jan 27, 2021

CLA assistant check
All CLA requirements met.

@github-actions
Copy link
Contributor

Messages
📖

Translation of allowSyntheticDefaultImports.md


display: "Allow Predefined Synthetic Import"

oneline: "Allows you to import an x module from a y' module when a module does not have a standard export"

When set to true, allowSyntheticDefaultImports allows you to write an import like this:

import React from "react";

Instead of:

import * as React from "react";

When a form Not explicitly specifies a default export.

For example, without allowSyntheticDefaultImports set to true:

// @errors: 1259 1192
// @checkJs
// @allowJs
// @esModuleInterop: false
// @filename: utilFunctions.js
// @noImplicitAny: false
const getStringLength = (str) => str.length;

module.exports = {
  getStringLength,
};

// @filename: index.ts
import utils from "./utilFunctions";

const count = utils.getStringLength("Check JS");

this code reports an error because an object default that you can import is not present. Although it looks like it should be there. For convenience, if an object default there is no transpiler as Babel will automatically create it.

// @filename: utilFunctions.js
const getStringLength = (str) => str.length;
const allFunctions = {
  getStringLength,
};

module.exports = allFunctions;
module.exports.default = allFunctions;

This flag does not make changes to the JavaScript issued by TypeScript, it is only to check the type. This option brings TypeScript behavior in line with Babel by issuing extra code to make the use of a default export more ergonomic.

📖

Translation of allowUmdGlobalAccess.md


display: "Allow UMD Global Access"

oneline: "Makes all UMD imports available globally"

When set to true, the allowUmdGlobalAccess allows you to access UMD exports as global within the form archive. A module file is a file that has imports and/or exports. Without this flag to use an export of a UMD module you must declare an import.

An example of using this flag is a web project where you know the particular libraries (such as jQuery or Lodash) that will always be available at runtime, but you can't access them with an import.

📖

Translation of allowUnreachableCode.md


display: "Allow Unreachable Code"

oneline: "Displays an error when the code will never run"

When:

  • undefined (default) provide suggestions as a warning to editors
  • true unattainable code is ignored
  • false displays a compilation error when unattainable code is found

These warnings are only for code that is probably unreachable due to the use of JavaScript syntax, for example:

function fn(n: number) {
  if (n > 5) {
    return true;
  } else {
    return false;
  }
  return true;
}

With "allowUnreachableCode": false:

// @errors: 7027
// @allowUnreachableCode: false
function fn(n: number) {
  if (n > 5) {
    return true;
  } else {
    return false;
  }
  return true;
}

this does not affect errors based on the code that Seems to be unattainable due to type analysis.

Generated by 🚫 dangerJS against 735542b

@orta orta merged commit cc19f8b into microsoft:main Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants