Skip to content

Commit

Permalink
doc(types): Document Assumptions API (#9746)
Browse files Browse the repository at this point in the history
**Related issue:**

 - Closes #9743
  • Loading branch information
kdy1 authored Nov 19, 2024
1 parent 35b0ca0 commit cd4321c
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 4 deletions.
113 changes: 113 additions & 0 deletions packages/types/assumptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
export interface Assumptions {
/**
* https://babeljs.io/docs/en/assumptions#arraylikeisiterable
*/
arrayLikeIsIterable?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#constantreexports
*/
constantReexports?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#constantsuper
*/
constantSuper?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#enumerablemodulemeta
*/
enumerableModuleMeta?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#ignorefunctionlength
*/
ignoreFunctionLength?: boolean;

ignoreFunctionName?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#ignoretoprimitivehint
*/
ignoreToPrimitiveHint?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#iterableisarray
*/
iterableIsArray?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#mutabletemplateobject
*/
mutableTemplateObject?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#noclasscalls
*/
noClassCalls?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#nodocumentall
*/
noDocumentAll?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#noincompletensimportdetection
*/
noIncompleteNsImportDetection?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#nonewarrows
*/
noNewArrows?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#objectrestnosymbols
*/
objectRestNoSymbols?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#privatefieldsasproperties
*/
privateFieldsAsProperties?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#puregetters
*/
pureGetters?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#setclassmethods
*/
setClassMethods?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#setcomputedproperties
*/
setComputedProperties?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#setpublicclassfields
*/
setPublicClassFields?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#setspreadproperties
*/
setSpreadProperties?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#skipforofiteratorclosing
*/
skipForOfIteratorClosing?: boolean;

/**
* https://babeljs.io/docs/en/assumptions#superiscallableconstructor
*/
superIsCallableConstructor?: boolean;

/**
* @deprecated This value will be always true
*/
tsEnumIsReadonly?: boolean;
}
9 changes: 6 additions & 3 deletions packages/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Assumptions } from "./assumptions";

export interface Plugin {
(module: Program): Program;
}
Expand Down Expand Up @@ -349,7 +351,7 @@ export interface TerserMangleOptions {
reserved?: string[];
}

export interface TerserManglePropertiesOptions { }
export interface TerserManglePropertiesOptions {}

/**
* Programmatic options.
Expand Down Expand Up @@ -608,6 +610,7 @@ export interface EnvConfig {
}

export interface JscConfig {
assumptions?: Assumptions;
loose?: boolean;

/**
Expand Down Expand Up @@ -1175,7 +1178,7 @@ export interface Output {
map?: string;
}

export interface MatchPattern { }
export interface MatchPattern {}

// -------------------------------
// ---------- Ast nodes ----------
Expand Down Expand Up @@ -1407,7 +1410,7 @@ export type Expression =
| OptionalChainingExpression
| Invalid;

interface ExpressionBase extends Node, HasSpan { }
interface ExpressionBase extends Node, HasSpan {}

export interface Identifier extends ExpressionBase {
type: "Identifier";
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@swc/types",
"packageManager": "[email protected]",
"version": "0.1.15",
"version": "0.1.16",
"description": "Typings for the swc project.",
"sideEffects": false,
"scripts": {
Expand Down

0 comments on commit cd4321c

Please sign in to comment.