From 35abb7f89b692af3ed237d65d56ff90ce4dd9831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Vr=C3=A1na?= Date: Thu, 12 Mar 2020 17:02:29 +0100 Subject: [PATCH] Add non-nullable modifier to return type of functions never returning null (#5797) --- js/flatbuffers.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/js/flatbuffers.js b/js/flatbuffers.js index 461cd7af8..74cd35ab8 100644 --- a/js/flatbuffers.js +++ b/js/flatbuffers.js @@ -110,7 +110,7 @@ flatbuffers.Long = function(low, high) { /** * @param {number} low * @param {number} high - * @returns {flatbuffers.Long} + * @returns {!flatbuffers.Long} */ flatbuffers.Long.create = function(low, high) { // Special-case zero to avoid GC overhead for default values @@ -133,7 +133,7 @@ flatbuffers.Long.prototype.equals = function(other) { }; /** - * @type {flatbuffers.Long} + * @type {!flatbuffers.Long} * @const */ flatbuffers.Long.ZERO = new flatbuffers.Long(0, 0); @@ -271,7 +271,7 @@ flatbuffers.Builder.prototype.dataBuffer = function() { * Get the bytes representing the FlatBuffer. Only call this after you've * called finish(). * - * @returns {Uint8Array} + * @returns {!Uint8Array} */ flatbuffers.Builder.prototype.asUint8Array = function() { return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset()); @@ -556,7 +556,7 @@ flatbuffers.Builder.prototype.offset = function() { * the end of the new buffer (since we build the buffer backwards). * * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data - * @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied + * @returns {!flatbuffers.ByteBuffer} A new byte buffer with the old data copied * to it. The data is located at the end of the buffer. * * uint8Array.set() formally takes {Array|ArrayBufferView}, so to pass @@ -825,7 +825,7 @@ flatbuffers.Builder.prototype.createString = function(s) { * * @param {number} low * @param {number} high - * @returns {flatbuffers.Long} + * @returns {!flatbuffers.Long} */ flatbuffers.Builder.prototype.createLong = function(low, high) { return flatbuffers.Long.create(low, high); @@ -856,7 +856,7 @@ flatbuffers.ByteBuffer = function(bytes) { * Create and allocate a new ByteBuffer with a given size. * * @param {number} byte_size - * @returns {flatbuffers.ByteBuffer} + * @returns {!flatbuffers.ByteBuffer} */ flatbuffers.ByteBuffer.allocate = function(byte_size) { return new flatbuffers.ByteBuffer(new Uint8Array(byte_size)); @@ -952,7 +952,7 @@ flatbuffers.ByteBuffer.prototype.readUint32 = function(offset) { /** * @param {number} offset - * @returns {flatbuffers.Long} + * @returns {!flatbuffers.Long} */ flatbuffers.ByteBuffer.prototype.readInt64 = function(offset) { return new flatbuffers.Long(this.readInt32(offset), this.readInt32(offset + 4)); @@ -960,7 +960,7 @@ flatbuffers.ByteBuffer.prototype.readInt64 = function(offset) { /** * @param {number} offset - * @returns {flatbuffers.Long} + * @returns {!flatbuffers.Long} */ flatbuffers.ByteBuffer.prototype.readUint64 = function(offset) { return new flatbuffers.Long(this.readUint32(offset), this.readUint32(offset + 4)); @@ -1135,7 +1135,7 @@ flatbuffers.ByteBuffer.prototype.__union = function(t, offset) { * * @param {number} offset * @param {flatbuffers.Encoding=} opt_encoding Defaults to UTF16_STRING - * @returns {string|Uint8Array} + * @returns {string|!Uint8Array} */ flatbuffers.ByteBuffer.prototype.__string = function(offset, opt_encoding) { offset += this.readInt32(offset); @@ -1246,7 +1246,7 @@ flatbuffers.ByteBuffer.prototype.__has_identifier = function(ident) { * * @param {number} low * @param {number} high - * @returns {flatbuffers.Long} + * @returns {!flatbuffers.Long} */ flatbuffers.ByteBuffer.prototype.createLong = function(low, high) { return flatbuffers.Long.create(low, high);