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

feat: Add TS 5.6 and ESNext target support #4763

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libraries/adaptive-expressions/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
.nyc_output
/**/.antlr
/**/*.interp
tests/expressionProperty.test.js
tests/expressionProperty.test.js
!types/**
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,7 @@ export class FuncInvokeExpContext extends PrimaryExpressionContext {

// @public
export class FunctionTable implements Map<string, ExpressionEvaluator> {
get [Symbol.iterator](): () => IterableIterator<[string, ExpressionEvaluator]>;
get [Symbol.iterator](): () => MapIterator<[string, ExpressionEvaluator]>;
get [Symbol.toStringTag](): string;
// (undocumented)
add(item: {
Expand All @@ -1942,15 +1942,15 @@ export class FunctionTable implements Map<string, ExpressionEvaluator> {
add(key: string, value: customFunction): void;
clear(): void;
delete(key: string): boolean;
entries(): IterableIterator<[string, ExpressionEvaluator]>;
entries(): MapIterator<[string, ExpressionEvaluator]>;
forEach(_callbackfn: (value: ExpressionEvaluator, key: string, map: Map<string, ExpressionEvaluator>) => void, _thisArg?: any): void;
get(key: string): ExpressionEvaluator;
has(key: string): boolean;
get isReadOnly(): boolean;
keys(): IterableIterator<string>;
keys(): MapIterator<string>;
set(key: string, value: ExpressionEvaluator): this;
get size(): number;
values(): IterableIterator<ExpressionEvaluator>;
values(): MapIterator<ExpressionEvaluator>;
}

// @public
Expand Down
15 changes: 9 additions & 6 deletions libraries/adaptive-expressions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
"type": "git",
"url": "https://github.com/Microsoft/botbuilder-js.git"
},
"main": "./lib/index.js",
"browser": "./lib/browser.js",
"typings": "./lib/index.d.ts",
"main": "lib/index.js",
"browser": "lib/browser.js",
"types": "lib/index.d.ts",
"typesVersions": {
"<5.6": { "*": [ "types/ts5.6/*" ] }
},
"dependencies": {
"@microsoft/recognizers-text-data-types-timex-expression": "~1.3.1",
"@types/atob-lite": "^2.0.2",
"@types/btoa-lite": "^1.0.2",
"@types/lodash.isequal": "^4.5.8",
"@types/lru-cache": "^5.1.1",
"antlr4ts": "0.5.0-alpha.4",
"atob-lite": "^2.0.0",
Expand All @@ -33,7 +35,7 @@
"d3-format": "^2.0.0",
"dayjs": "^1.11.13",
"jspath": "^0.4.0",
"lodash.isequal": "^4.5.0",
"lodash": "^4.17.21",
"lru-cache": "^5.1.1",
"uuid": "^10.0.0",
"fast-xml-parser": "^4.4.1",
Expand Down Expand Up @@ -62,6 +64,7 @@
},
"files": [
"lib",
"src"
"src",
"types"
]
}
8 changes: 4 additions & 4 deletions libraries/adaptive-expressions/src/functionTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class FunctionTable implements Map<string, ExpressionEvaluator> {
*
* @returns A list of string values.
*/
keys(): IterableIterator<string> {
keys(): MapIterator<string> {
const keysOfAllFunctions = Array.from(ExpressionFunctions.standardFunctions.keys()).concat(
Array.from(this.customFunctions.keys())
);
Expand All @@ -35,7 +35,7 @@ export class FunctionTable implements Map<string, ExpressionEvaluator> {
*
* @returns A list of [ExpressionEvaluator](xref:adaptive-expressions.ExpressionEvaluator).
*/
values(): IterableIterator<ExpressionEvaluator> {
values(): MapIterator<ExpressionEvaluator> {
const valuesOfAllFunctions = Array.from(ExpressionFunctions.standardFunctions.values()).concat(
Array.from(this.customFunctions.values())
);
Expand Down Expand Up @@ -168,15 +168,15 @@ export class FunctionTable implements Map<string, ExpressionEvaluator> {
* Returns an iterable of key, value pairs for every entry in the map.
* Not implemented.
*/
entries(): IterableIterator<[string, ExpressionEvaluator]> {
entries(): MapIterator<[string, ExpressionEvaluator]> {
throw Error('entries function not implemented');
}

/**
* Returns an iterable of key, value pairs.
* Not implemented.
*/
get [Symbol.iterator](): () => IterableIterator<[string, ExpressionEvaluator]> {
get [Symbol.iterator](): () => MapIterator<[string, ExpressionEvaluator]> {
throw Error('Symbol.iterator function not implemented');
}

Expand Down
3 changes: 1 addition & 2 deletions libraries/adaptive-expressions/src/functionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { ExpressionType } from './expressionType';
import { MemoryInterface } from './memory';
import { Options } from './options';
import { ReturnType } from './returnType';
// eslint-disable-next-line lodash/import-scope
import isEqual from 'lodash.isequal';
import isEqual from 'lodash/isEqual';

/**
* Verify the result of an expression is of the appropriate type and return a string if not.
Expand Down
5 changes: 4 additions & 1 deletion libraries/adaptive-expressions/tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"declarationMap": false,
"sourceMap": false
},
"include": ["*.ts"]
"include": [
"*.ts",
"../types/**/*"
]
}
3 changes: 2 additions & 1 deletion libraries/adaptive-expressions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"rootDir": "src"
},
"include": [
"src/**/*"
"src/**/*",
"types/**/*"
]
}
14 changes: 14 additions & 0 deletions libraries/adaptive-expressions/types/ts5.6/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @module adaptive-expressions
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

declare global {
interface MapIterator<T> extends IterableIterator<T> {}
}

// @ts-ignore - the following export is only required for projects referencing adaptive-expressions, otherwise it will fail at build time.
export * from '../../../lib';
15 changes: 10 additions & 5 deletions testing/consumer-test/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ import { promisify } from 'util';

const execp = promisify(exec);

const versions = ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5'];
const versions = ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6'];

(async () => {
const flags = minimist(process.argv.slice(2), {
boolean: ['versbose'],
boolean: ['verbose'],
alias: { v: 'verbose' },
});

try {
console.log(`Running typescript consumer test against ["${versions.join('", "')}"]`);
const [minTarget, maxTarget] = ['es6', 'esnext'];
console.log(
`Running typescript consumer test against ["${versions.join(
'", "'
)}"] with '${minTarget}' and '${maxTarget}' targets.`
);

const results = await pmap(
versions,
(version) =>
Promise.all([
execp(`npx -p typescript@${version} tsc -p tsconfig-test.json`),
execp(`npx -p typescript@${version} tsc -p tsconfig-test.json --lib es2018`),
execp(`npx -p typescript@${version} tsc -p tsconfig-test.json --target ${minTarget}`),
execp(`npx -p typescript@${version} tsc -p tsconfig-test.json --target ${maxTarget}`),
])
.then(() => ({ err: null, version, success: true }))
.catch((err) => ({ err, version, success: false })),
Expand Down
12 changes: 0 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3050,18 +3050,6 @@
resolved "https://registry.yarnpkg.com/@types/jspath/-/jspath-0.4.2.tgz#c51f930d5428a786da9c12a6e0077b1f9d148c3c"
integrity sha512-NltGdfyWyW36ZToRhwuQhzRRKuw29NSaMEwTZ4eGFlS49ZzbZ4fDXTC+JfTpSVSUy6ru+fR+nXypWSkKVE5zMQ==

"@types/lodash.isequal@^4.5.8":
version "4.5.8"
resolved "https://registry.yarnpkg.com/@types/lodash.isequal/-/lodash.isequal-4.5.8.tgz#b30bb6ff6a5f6c19b3daf389d649ac7f7a250499"
integrity sha512-uput6pg4E/tj2LGxCZo9+y27JNyB2OZuuI/T5F+ylVDYuqICLG2/ktjxx0v6GvVntAf8TvEzeQLcV0ffRirXuA==
dependencies:
"@types/lodash" "*"

"@types/lodash@*":
version "4.14.168"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==

"@types/lodash@^4.17.7":
version "4.17.7"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.7.tgz#2f776bcb53adc9e13b2c0dfd493dfcbd7de43612"
Expand Down
Loading