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

Prevent unused types warnings #609

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ export class InternalBinaryRead implements CustomMethodGenerator {
MessageInterface = this.imports.type(source, descriptor),
IBinaryReader = this.imports.name(source, 'IBinaryReader', this.options.runtimeImportPath, true),
BinaryReadOptions = this.imports.name(source, 'BinaryReadOptions', this.options.runtimeImportPath, true);
const empty = descriptor.field.length === 0;
return ts.createMethod(undefined, undefined, undefined, ts.createIdentifier("internalBinaryRead"), undefined, undefined,
[
ts.createParameter(undefined, undefined, undefined, ts.createIdentifier("reader"), undefined, ts.createTypeReferenceNode(IBinaryReader, undefined), undefined),
ts.createParameter(undefined, undefined, undefined, ts.createIdentifier("length"), undefined, ts.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword), undefined),
ts.createParameter(undefined, undefined, undefined, ts.createIdentifier("options"), undefined,
ts.createParameter(undefined, undefined, undefined, ts.createIdentifier(empty ? "_reader" : "reader"), undefined, ts.createTypeReferenceNode(IBinaryReader, undefined), undefined),
ts.createParameter(undefined, undefined, undefined, ts.createIdentifier(empty ? "_length" : "length"), undefined, ts.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword), undefined),
ts.createParameter(undefined, undefined, undefined, ts.createIdentifier(empty ? "_options" : "options"), undefined,
ts.createTypeReferenceNode(BinaryReadOptions, undefined), undefined
),
ts.createParameter(undefined, undefined, undefined, ts.createIdentifier("target"), ts.createToken(ts.SyntaxKind.QuestionToken),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class WellKnownTypes implements CustomMethodGenerator {
* In JSON format, the \`Timestamp\` type is encoded as a string
* in the RFC 3339 format.
*/
function internalJsonWrite(message: ${Timestamp}, options: ${JsonWriteOptions}): ${JsonValue} {
function internalJsonWrite(message: ${Timestamp}, _options: ${JsonWriteOptions}): ${JsonValue} {
let ms = PbLong.from(message.seconds).toNumber() * 1000;
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
Expand All @@ -254,7 +254,7 @@ export class WellKnownTypes implements CustomMethodGenerator {
* In JSON format, the \`Timestamp\` type is encoded as a string
* in the RFC 3339 format.
*/
function internalJsonRead(json: ${JsonValue}, options: ${JsonReadOptions}, target?: ${Timestamp}): ${Timestamp} {
function internalJsonRead(json: ${JsonValue}, _options: ${JsonReadOptions}, target?: ${Timestamp}): ${Timestamp} {
if (typeof json !== "string")
throw new Error("Unable to parse Timestamp from JSON " + ${typeofJsonValue}(json) + ".");
// RFC 3339 with "Z" (UTC) or offset like "+08:00" and optional fractions
Expand Down