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

Upgrade to TypeScript 5.0 #574

Merged
merged 4 commits into from
Apr 4, 2023
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
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"npm": ">=8"
},
"devDependencies": {
"typescript": "^4.9.5",
"typescript": "^5.0.3",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"eslint": "^8.33.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rm -rf ./dist/cjs/* ./dist/esm/* ./dist/types/*",
"build": "npm run build:cjs && npm run build:esm+types",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm --declaration --declarationDir ./dist/types"
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types"
},
"main": "./dist/cjs/index.js",
"type": "module",
Expand Down
3 changes: 1 addition & 2 deletions packages/connect-express/src/express-connect-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

import type { JsonValue } from "@bufbuild/protobuf";
import {
ConnectRouter,
createConnectRouter,
ConnectRouterOptions,
Code,
connectErrorFromReason,
} from "@bufbuild/connect";
import type { ConnectRouter, ConnectRouterOptions } from "@bufbuild/connect";
import type { UniversalHandler } from "@bufbuild/connect/protocol";
import { compressionBrotli, compressionGzip } from "@bufbuild/connect-node";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rm -rf ./dist/cjs/* ./dist/esm/* ./dist/types/*",
"build": "npm run build:cjs && npm run build:esm+types",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm --declaration --declarationDir ./dist/types"
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types"
},
"main": "./dist/cjs/index.js",
"type": "module",
Expand Down
3 changes: 1 addition & 2 deletions packages/connect-fastify/src/fastify-connect-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import type { JsonValue } from "@bufbuild/protobuf";
import {
Code,
connectErrorFromReason,
ConnectRouter,
ConnectRouterOptions,
createConnectRouter,
} from "@bufbuild/connect";
import type { ConnectRouter, ConnectRouterOptions } from "@bufbuild/connect";
import * as protoConnect from "@bufbuild/connect/protocol-connect";
import * as protoGrpcWeb from "@bufbuild/connect/protocol-grpc-web";
import * as protoGrpc from "@bufbuild/connect/protocol-grpc";
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rm -rf ./dist/cjs/* ./dist/esm/* ./dist/types/*",
"build": "npm run build:cjs && npm run build:esm+types",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm --declaration --declarationDir ./dist/types"
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types"
},
"main": "./dist/cjs/index.js",
"type": "module",
Expand Down
7 changes: 2 additions & 5 deletions packages/connect-next/src/connect-nextjs-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {
ConnectRouter,
ConnectRouterOptions,
createConnectRouter,
} from "@bufbuild/connect";
import { createConnectRouter } from "@bufbuild/connect";
import type { ConnectRouter, ConnectRouterOptions } from "@bufbuild/connect";
import type { UniversalHandler } from "@bufbuild/connect/protocol";
import {
compressionBrotli,
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-node-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"clean": "rm -rf ./dist/esm/*",
"generate": "buf generate",
"build": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm",
"build": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm",
"jasmine": "jasmine --config=jasmine.json"
},
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
// limitations under the License.

import {
CallOptions,
Code,
ConnectError,
createCallbackClient,
createPromiseClient,
connectErrorFromReason,
} from "@bufbuild/connect";
import type { CallOptions } from "@bufbuild/connect";
import { TestService } from "../gen/grpc/testing/test_connect.js";
import { StreamingOutputCallRequest } from "../gen/grpc/testing/messages_pb.js";
import { createTestServers } from "../helpers/testserver.js";
Expand Down
3 changes: 2 additions & 1 deletion packages/connect-node-test/src/express-readme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

import * as http from "http";
import { Message, MethodKind, proto3 } from "@bufbuild/protobuf";
import { ConnectRouter, createPromiseClient } from "@bufbuild/connect";
import { createPromiseClient } from "@bufbuild/connect";
import type { ConnectRouter } from "@bufbuild/connect";
import { expressConnectMiddleware } from "@bufbuild/connect-express";
import { createGrpcWebTransport } from "@bufbuild/connect-node";
import { importExpress } from "./helpers/import-express.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {
import { MethodKind } from "@bufbuild/protobuf";
import type {
AnyMessage,
BinaryReadOptions,
BinaryWriteOptions,
MethodKind,
PartialMessage,
ServiceType,
} from "@bufbuild/protobuf";
Expand Down
3 changes: 1 addition & 2 deletions packages/connect-node-test/src/helpers/test-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
import {
Code,
ConnectError,
ConnectRouter,
decodeBinaryHeader,
encodeBinaryHeader,
ServiceImpl,
} from "@bufbuild/connect";
import type { ConnectRouter, ServiceImpl } from "@bufbuild/connect";
import { TestService } from "../gen/grpc/testing/test_connect.js";
import type { StreamingOutputCallRequest } from "../gen/grpc/testing/messages_pb.js";
import { interop } from "./interop.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-node-test/src/helpers/testserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
} from "@bufbuild/connect-node";
import { fastifyConnectPlugin } from "@bufbuild/connect-fastify";
import { expressConnectMiddleware } from "@bufbuild/connect-express";
import {
fastify,
import { fastify } from "fastify";
import type {
FastifyBaseLogger,
FastifyInstance,
FastifyTypeProviderDefault,
Expand Down
3 changes: 2 additions & 1 deletion packages/connect-node-test/src/node-readme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

import * as http2 from "http2";
import { Message, MethodKind, proto3 } from "@bufbuild/protobuf";
import { ConnectRouter, createPromiseClient } from "@bufbuild/connect";
import { createPromiseClient } from "@bufbuild/connect";
import type { ConnectRouter } from "@bufbuild/connect";
import {
connectNodeAdapter,
createGrpcTransport,
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"clean": "rm -rf ./dist/cjs/* ./dist/esm/* ./dist/types/*",
"build": "npm run build:cjs && npm run build:esm+types",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm --declaration --declarationDir ./dist/types",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types",
"jasmine": "jasmine --config=jasmine.json"
},
"main": "./dist/cjs/index.js",
Expand Down
9 changes: 5 additions & 4 deletions packages/connect-node/src/connect-node-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
import {
Code,
connectErrorFromReason,
ConnectRouter,
ConnectRouterOptions,
createConnectRouter,
} from "@bufbuild/connect";
import type { ConnectRouter, ConnectRouterOptions } from "@bufbuild/connect";
import type { UniversalHandler } from "@bufbuild/connect/protocol";
import { uResponseNotFound } from "@bufbuild/connect/protocol";
import {
universalRequestFromNodeRequest,
universalResponseToNodeResponse,
} from "./node-universal-handler.js";
import type {
NodeHandlerFn,
NodeServerRequest,
NodeServerResponse,
universalRequestFromNodeRequest,
universalResponseToNodeResponse,
} from "./node-universal-handler.js";
import { compressionBrotli, compressionGzip } from "./compression.js";

Expand Down
4 changes: 2 additions & 2 deletions packages/connect-node/src/connect-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import type {
import type { Interceptor, Transport } from "@bufbuild/connect";
import type { Compression } from "@bufbuild/connect/protocol";
import { createTransport } from "@bufbuild/connect/protocol-connect";
import {
import { validateNodeTransportOptions } from "./validate-node-transport-options.js";
import type {
NodeHttp1TransportOptions,
NodeHttp2TransportOptions,
validateNodeTransportOptions,
} from "./validate-node-transport-options.js";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-web-bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ it like a web server would usually do.

| code generator | bundle size | minified | compressed |
|----------------|-------------------:|-----------------------:|---------------------:|
| connect | 107,215 b | 46,955 b | 12,525 b |
| connect | 107,197 b | 46,935 b | 12,539 b |
| grpc-web | 414,906 b | 301,127 b | 53,279 b |
2 changes: 1 addition & 1 deletion packages/connect-web-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"clean": "rm -rf ./dist/esm/*",
"generate": "buf generate",
"build": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm",
"build": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm",
"jasmine": "jasmine --config=jasmine.json",
"karma": "karma start karma.conf.cjs",
"karma-serve": "karma start karma.serve.conf.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-web-test/src/cancellation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// limitations under the License.

import {
CallOptions,
Code,
ConnectError,
createCallbackClient,
createPromiseClient,
} from "@bufbuild/connect";
import type { CallOptions } from "@bufbuild/connect";
import { describeTransports } from "./helpers/crosstestserver.js";
import { TestService } from "./gen/grpc/testing/test_connect.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/connect-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rm -rf ./dist/cjs/* ./dist/esm/* ./dist/types/*",
"build": "npm run build:cjs && npm run build:esm+types",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm --declaration --declarationDir ./dist/types"
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types"
},
"main": "./dist/cjs/index.js",
"type": "module",
Expand Down
17 changes: 8 additions & 9 deletions packages/connect-web/src/connect-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,31 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {
import { Message, MethodKind } from "@bufbuild/protobuf";
import type {
AnyMessage,
BinaryReadOptions,
BinaryWriteOptions,
JsonReadOptions,
JsonValue,
JsonWriteOptions,
Message,
MethodInfo,
MethodKind,
PartialMessage,
ServiceType,
} from "@bufbuild/protobuf";
import type {
Interceptor,
Transport,
UnaryRequest,
UnaryResponse,
} from "@bufbuild/connect";
import {
appendHeaders,
Code,
connectErrorFromReason,
runStreaming,
runUnary,
} from "@bufbuild/connect";
import type {
Interceptor,
StreamResponse,
Transport,
UnaryRequest,
UnaryResponse,
} from "@bufbuild/connect";
import {
createClientMethodSerializers,
Expand Down
9 changes: 5 additions & 4 deletions packages/connect-web/src/grpc-web-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {
import { Message, MethodKind } from "@bufbuild/protobuf";
import type {
AnyMessage,
BinaryReadOptions,
BinaryWriteOptions,
JsonReadOptions,
JsonWriteOptions,
Message,
MethodInfo,
MethodKind,
PartialMessage,
ServiceType,
} from "@bufbuild/protobuf";
import type { UnaryRequest } from "@bufbuild/connect";
import {
Code,
connectErrorFromReason,
Interceptor,
runStreaming,
runUnary,
} from "@bufbuild/connect";
import type {
Interceptor,
StreamResponse,
Transport,
UnaryResponse,
Expand Down
6 changes: 4 additions & 2 deletions packages/connect-web/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export type { GrpcWebTransportOptions } from "./grpc-web-transport.js";
// please please import from @bufbuild/connect instead
// TODO(TCN-1261)
import {
CallbackClient,
CallOptions,
Code,
ConnectError,
connectErrorDetails,
Expand All @@ -31,6 +29,10 @@ import {
createPromiseClient,
decodeBinaryHeader,
encodeBinaryHeader,
} from "@bufbuild/connect";
import type {
CallbackClient,
CallOptions,
Interceptor,
PromiseClient,
StreamRequest,
Expand Down
2 changes: 1 addition & 1 deletion packages/connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"generate": "buf generate src/protocol-grpc/proto",
"build": "npm run build:cjs && npm run build:esm+types",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm --declaration --declarationDir ./dist/types && echo >./dist/esm/package.json '{\"type\":\"module\", \"sideEffects\":false}'",
"build:esm+types": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types && echo >./dist/esm/package.json '{\"type\":\"module\", \"sideEffects\":false}'",
"jasmine": "jasmine --config=jasmine.json"
},
"main": "./dist/cjs/index.js",
Expand Down
5 changes: 2 additions & 3 deletions packages/connect/src/connect-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
// limitations under the License.

import { Code } from "./code.js";
import {
import { createRegistry, Message } from "@bufbuild/protobuf";
import type {
AnyMessage,
createRegistry,
IMessageTypeRegistry,
JsonValue,
Message,
MessageType,
} from "@bufbuild/protobuf";
import { codeToString } from "./protocol-connect/index.js";
Expand Down
Loading