Skip to content

Commit

Permalink
Upgrade typescript and typedoc (#12457)
Browse files Browse the repository at this point in the history
Typedoc has a peer dep on typescript so we need to bump both.

changelog_begin
changelog_end
  • Loading branch information
cocreature authored Jan 18, 2022
1 parent 2640bc6 commit f07791e
Show file tree
Hide file tree
Showing 17 changed files with 501 additions and 531 deletions.
4 changes: 2 additions & 2 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ buildifier_version = "4.0.0"
buildifier_sha256 = "0d3ca4ed434958dda241fb129f77bd5ef0ce246250feed2d5a5470c6f29a77fa"
zlib_version = "1.2.11"
zlib_sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff"
rules_nodejs_version = "4.4.2"
rules_nodejs_sha256 = "3aa6296f453ddc784e1377e0811a59e1e6807da364f44b27856e34f5042043fe"
rules_nodejs_version = "4.6.1"
rules_nodejs_sha256 = "d63ecec7192394f5cc4ad95a115f8a6c9de55c60d56c1f08da79c306355e4654"
rules_jvm_external_version = "3.3"
rules_jvm_external_sha256 = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab"
rules_go_version = "0.29.0"
Expand Down
8 changes: 7 additions & 1 deletion language-support/ts/daml-ledger/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
],
"rules": {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-inferrable-types": "off"
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/restrict-template-expressions": "off"
}
}
3 changes: 0 additions & 3 deletions language-support/ts/daml-ledger/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//language-support/ts:defs.bzl", "da_ts_library")
load("//language-support/ts:eslint.bzl", "eslint_test")
load("//language-support/ts:typedoc.bzl", "ts_docs")
load("@build_environment//:configuration.bzl", "sdk_version")
load("//language-support/ts:jest.bzl", "jest_test")

Expand Down Expand Up @@ -43,8 +42,6 @@ genrule(
""",
)

ts_docs("daml-ledger")

eslint_test(
name = "lint",
srcs = sources,
Expand Down
3 changes: 2 additions & 1 deletion language-support/ts/daml-ledger/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const Foo: Template<Foo, string, "foo-id"> = {
keyEncode: (s: string): unknown => s,
decoder: jtv.object({key: jtv.string()}),
encode: (o) => o,
// eslint-disable-next-line @typescript-eslint/ban-types
Archive: {} as unknown as Choice<Foo, {}, {}, string>,
};

Expand Down Expand Up @@ -461,7 +462,7 @@ describe("streamFetchByKeys", () => {
const create = (cid: number, key: string): Event<Foo> => ({created: fooCreateEvent(cid, key), matchedQueries: [0]});
const archive = fooArchiveEvent;
const send = (events: Event<Foo>[]): void => mockInstance.serverSend({events});
const expectCids = (expected: (number | null)[]): void => expect(mockChange) .toHaveBeenCalledWith( expected.map((cid: number | null, idx) => cid ? fooCreateEvent(cid, 'key' + (idx + 1)) : null));
const expectCids = (expected: (number | null)[]): void => expect(mockChange) .toHaveBeenCalledWith( expected.map((cid: number | null, idx) => cid ? fooCreateEvent(cid, `key${idx + 1}`) : null));

const ledger = new Ledger(mockOptions);
const stream = ledger.streamFetchByKeys(Foo, ['key1', 'key2']);
Expand Down
1 change: 1 addition & 0 deletions language-support/ts/daml-ledger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const decodeEventUnknown: jtv.Decoder<Event<object>> = jtv.oneOf<Event<object>>(
async function decodeArchiveResponse<T extends object, K, I extends string>(
template: Template<T, K, I>,
archiveMethod: 'archive' | 'archiveByKey',
// eslint-disable-next-line @typescript-eslint/ban-types
archiveCommand: () => Promise<[{}, Event<object>[]]>,
): Promise<ArchiveEvent<T, I>> {
// eslint-disable-next-line no-empty-pattern
Expand Down
8 changes: 7 additions & 1 deletion language-support/ts/daml-react/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
],
"rules": {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-inferrable-types": "off"
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/restrict-template-expressions": "off"
}
}
3 changes: 0 additions & 3 deletions language-support/ts/daml-react/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//language-support/ts:defs.bzl", "da_ts_library")
load("//language-support/ts:eslint.bzl", "eslint_test")
load("//language-support/ts:jest.bzl", "jest_test")
load("//language-support/ts:typedoc.bzl", "ts_docs")
load("@build_environment//:configuration.bzl", "sdk_version")

sources = [
Expand Down Expand Up @@ -39,8 +38,6 @@ genrule(
""",
)

ts_docs("daml-react")

eslint_test(
name = "lint",
srcs = sources,
Expand Down
1 change: 1 addition & 0 deletions language-support/ts/daml-react/createLedgerContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export function createLedgerContext(contextName="DamlLedgerContext"): LedgerCont
const ledger = useMemo(() => new Ledger({token, httpBaseUrl, wsBaseUrl, reconnectThreshold}), [token, httpBaseUrl, wsBaseUrl, reconnectThreshold]);
const state: DamlLedgerState = useMemo(() => ({
reloadToken,
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
triggerReload: (): void => setReloadToken(x => x + 1),
party,
ledger,
Expand Down
7 changes: 6 additions & 1 deletion language-support/ts/daml-types/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"rules": {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off"
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off"
}
}
2 changes: 0 additions & 2 deletions language-support/ts/daml-types/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ genrule(
""",
)

ts_docs("daml-types")

eslint_test(
name = "lint",
srcs = sources,
Expand Down
1 change: 1 addition & 0 deletions language-support/ts/daml-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface Template<T extends object, K = unknown, I extends string = stri
* @internal
*/
keyEncode: (k: K) => unknown;
// eslint-disable-next-line @typescript-eslint/ban-types
Archive: Choice<T, {}, {}, K>;
}

Expand Down
7 changes: 7 additions & 0 deletions language-support/ts/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@language_support_ts_deps//@bazel/typescript:index.bzl", "ts_project")
load("//language-support/ts:typedoc.bzl", "ts_docs")

def da_ts_library(
name,
Expand Down Expand Up @@ -41,3 +42,9 @@ def da_ts_library(
deps = ["_%s_ts" % name],
**kwargs
)

ts_docs(
name,
srcs,
deps,
)
14 changes: 6 additions & 8 deletions language-support/ts/packages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,26 @@
"jwt-simple": "^0.5.6",
"react": "^16.12.0 || ^17.0.0",
"react-test-renderer": "^16.12.0 || ^17.0.0",
"typescript": "~3.9.7",
"typescript": "~4.5.4",
"ws": "^7.4.6"
},
"devDependencies": {
"@bazel/hide-bazel-files": "1.7.0",
"@bazel/typescript": "^4.4.0",
"@bazel/typescript": "^4.6.1",
"@types/jest": "^26.0.23",
"@types/lodash": "4.14.161",
"@types/react": "^16.9.20 || ^17.0.0",
"@types/ws": "^7.2.1",
"@typescript-eslint/eslint-plugin": "^2.16.0",
"@typescript-eslint/parser": "^2.16.0",
"eslint": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"eslint": "^8.7.0",
"jest": "^27.0.5",
"jest-cli": "^27.0.5",
"jest-mock-console": "^1.0.0",
"ts-jest": "^27.0.3",
"typedoc": "^0.19.2"
"typedoc": "^0.22.11"
},
"resolutions": {
"marked": "^2.0.0",
"typedoc/**/marked": "^4.0.10",
"**/y18n": "^4.0.1",
"**/@types/react-test-renderer": "^16.9.3 || ^17.0.0",
"**/hosted-git-info": "^4.0.2",
Expand Down
Loading

0 comments on commit f07791e

Please sign in to comment.