diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 18fb7e44483920..dc133aae0c57a0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7937,7 +7937,7 @@ /types/token-introspection/ @DanielRose /types/token-stream/ @MaikoTan /types/tokgen/ @l-jonas -/types/tonic-ui__react/ @derekhawker @ZachLegros +/types/tonic-ui__react/ @derekhawker @ZachLegros @georgids9 /types/tonic-ui__react-icons/ @ZachLegros @derekhawker /types/toobusy-js/ @atd-schubert @BendingBender /types/tooltipster/ @stephenlautier @pjmagee @VorobeY1326 @leonard-thieu @janhi @joeskeen diff --git a/types/mapbox__mapbox-sdk/index.d.ts b/types/mapbox__mapbox-sdk/index.d.ts index 1f50cd5be965e4..24e6a4e59346d9 100644 --- a/types/mapbox__mapbox-sdk/index.d.ts +++ b/types/mapbox__mapbox-sdk/index.d.ts @@ -2156,17 +2156,17 @@ declare module "@mapbox/mapbox-sdk/services/tilequery" { */ geometry?: GeometryType | undefined; /** - * A comma-separated list of bands to query, rather than querying all bands. + * An array of bands to query, rather than querying all bands. * If a specified layer does not exist, it is skipped. * If no bands exist, returns an empty `FeatureCollection`. */ - bands?: string | undefined; + bands?: string[] | undefined; /** - * A comma-separated list of layers to query, rather than querying all layers. + * An array of layers to query, rather than querying all layers. * If a specified layer does not exist, it is skipped. * If no layers exist, returns an empty `FeatureCollection`. */ - layers?: string | undefined; + layers?: string[] | undefined; } interface TileQueryResponseProperty { diff --git a/types/mapbox__mapbox-sdk/mapbox__mapbox-sdk-tests.ts b/types/mapbox__mapbox-sdk/mapbox__mapbox-sdk-tests.ts index c373fcc701c101..216d73fccda6e7 100644 --- a/types/mapbox__mapbox-sdk/mapbox__mapbox-sdk-tests.ts +++ b/types/mapbox__mapbox-sdk/mapbox__mapbox-sdk-tests.ts @@ -360,8 +360,8 @@ optimizationService.getOptimization({ radius: 0, limit: 5, dedupe: true, - bands: "band1,band2", - layers: "layer1,layer2", + bands: ["band1", "band2"], + layers: ["layer1", "layer2"], } satisfies TileQueryRequest, ); diff --git a/types/meteor/mongo.d.ts b/types/meteor/mongo.d.ts index 2e1e13764f8b74..2679c6cd27fc67 100644 --- a/types/meteor/mongo.d.ts +++ b/types/meteor/mongo.d.ts @@ -479,8 +479,8 @@ declare module 'meteor/mongo' { callbacks: ObserveChangesCallbacks, options?: { nonMutatingCallbacks?: boolean | undefined }, ): Meteor.LiveQueryHandle; - [Symbol.iterator](): Iterator; - [Symbol.asyncIterator](): AsyncIterator; + [Symbol.iterator](): Iterator; + [Symbol.asyncIterator](): AsyncIterator; } var ObjectID: ObjectIDStatic; diff --git a/types/meteor/test/meteor-mongo-tests.ts b/types/meteor/test/meteor-mongo-tests.ts index f9103bbae88ed0..d98868d5d7b8a2 100644 --- a/types/meteor/test/meteor-mongo-tests.ts +++ b/types/meteor/test/meteor-mongo-tests.ts @@ -3,27 +3,31 @@ import { Mongo, MongoInternals } from 'meteor/mongo'; // Tests Mongo Collection Types // Test without default transform function -type DBUser = { +type UserDoc = { _id: string; name: string; surname: string; }; -// $ExpectType Collection -const Users = new Mongo.Collection('users'); +type UserModel = UserDoc & { + fullname(): string; +}; + +// $ExpectType Collection +const Users = new Mongo.Collection('users'); Users.find({}).map(doc => { - // $ExpectType DBUser + // $ExpectType UserModel doc; return doc; }); Users.find({}, {}).map(doc => { - // $ExpectType DBUser + // $ExpectType UserModel doc; return doc; }); Users.find({}, { transform: null }).map(doc => { - // $ExpectType DBUser + // $ExpectType UserDoc doc; return doc; }); @@ -31,7 +35,7 @@ Users.find( {}, { transform: doc => { - // $ExpectType DBUser + // $ExpectType UserDoc doc; return { fullName: `${doc.surname} ${doc.name}` }; }, @@ -48,32 +52,37 @@ Users.find({}).count(); // $ExpectType Promise Users.find({}).countAsync(); -// $ExpectType Promise +// $ExpectType Promise Users.find({}).mapAsync(doc => { - // $ExpectType DBUser + // $ExpectType UserModel doc; return doc; }); +for (const user of Users.find({})) { + // $ExpectType UserModel + user; +} + Users.deny({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserModel doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserModel doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserModel doc; return true; }, @@ -83,21 +92,21 @@ Users.deny({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserDoc doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserDoc doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserDoc doc; return true; }, @@ -129,28 +138,28 @@ Users.deny({ }, // Can not figure out why we should define manually type of document - transform: (doc: DBUser) => ({ fullName: `${doc.surname} ${doc.name}` }), + transform: (doc: UserDoc) => ({ fullName: `${doc.surname} ${doc.name}` }), }); Users.allow({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserModel doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserModel doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserModel doc; return true; }, @@ -160,21 +169,21 @@ Users.allow({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserDoc doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserDoc doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBUser + // $ExpectType UserDoc doc; return true; }, @@ -206,14 +215,14 @@ Users.allow({ }, // Can not figure out why we should define manually type of document - transform: (doc: DBUser) => ({ fullName: `${doc.surname} ${doc.name}` }), + transform: (doc: UserDoc) => ({ fullName: `${doc.surname} ${doc.name}` }), }); Users.find({}).observe({ changed: (newDoc, oldDoc) => { - // $ExpectType DBUser + // $ExpectType UserModel newDoc; - // $ExpectType DBUser + // $ExpectType UserModel oldDoc; return false; }, @@ -223,7 +232,7 @@ Users.find( {}, { transform: doc => { - // $ExpectType DBUser + // $ExpectType UserDoc doc; return { fullName: `${doc.surname} ${doc.name}` }; }, @@ -240,26 +249,26 @@ Users.find( Users.find({}, { transform: null }).observe({ changed: (newDoc, oldDoc) => { - // $ExpectType DBUser + // $ExpectType UserDoc newDoc; - // $ExpectType DBUser + // $ExpectType UserDoc oldDoc; return false; }, }); -// $ExpectType DBUser | undefined +// $ExpectType UserModel | undefined Users.findOne({}); -// $ExpectType DBUser | undefined +// $ExpectType UserModel | undefined Users.findOne({}, {}); -// $ExpectType DBUser | undefined +// $ExpectType UserDoc | undefined Users.findOne({}, { transform: null }); // $ExpectType { fullName: string; } | undefined Users.findOne( {}, { transform: doc => { - // $ExpectType DBUser + // $ExpectType UserDoc doc; return { fullName: `${doc.surname} ${doc.name}` }; }, @@ -267,15 +276,15 @@ Users.findOne( ); // Test with default transform function -type DBAttachment = { +type AttachmentDoc = { _id: string; size: number; }; -interface AttachmentDocument extends DBAttachment {} +interface AttachmentModel extends AttachmentDoc {} -class AttachmentDocument { - constructor(doc: DBAttachment) { +class AttachmentModel { + constructor(doc: AttachmentDoc) { Object.assign(this, doc); } @@ -284,27 +293,27 @@ class AttachmentDocument { } } -// $ExpectType Collection -export const Attachment = new Mongo.Collection('attachments', { +// $ExpectType Collection +export const Attachment = new Mongo.Collection('attachments', { transform: doc => { - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; - return new AttachmentDocument(doc); + return new AttachmentModel(doc); }, }); Attachment.find({}).map(doc => { - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return doc; }); Attachment.find({}, {}).map(doc => { - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return doc; }); Attachment.find({}, { transform: null }).map(doc => { - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return doc; }); @@ -312,7 +321,7 @@ Attachment.find( {}, { transform: doc => { - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return { fileSize: doc.size }; }, @@ -323,45 +332,50 @@ Attachment.find( return doc; }); -// $ExpectType AttachmentDocument | undefined +// $ExpectType AttachmentModel | undefined Attachment.findOne({}); -// $ExpectType AttachmentDocument | undefined +// $ExpectType AttachmentModel | undefined Attachment.findOne({}, {}); -// $ExpectType DBAttachment | undefined +// $ExpectType AttachmentDoc | undefined Attachment.findOne({}, { transform: null }); // $ExpectType { fileSize: number; } | undefined Attachment.findOne( {}, { transform: doc => { - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return { fileSize: doc.size }; }, }, ); -// $ExpectType Promise +// $ExpectType Promise Attachment.findOneAsync({}, { hint: 'indexName' }); +for (const attachment of Attachment.find({})) { + // $ExpectType AttachmentModel + attachment; +} + Attachment.deny({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return true; }, @@ -371,21 +385,21 @@ Attachment.deny({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return true; }, @@ -417,28 +431,28 @@ Attachment.deny({ }, // Can not figure out why we should define manually type of document - transform: (doc: DBAttachment) => ({ fileSize: doc.size }), + transform: (doc: AttachmentDoc) => ({ fileSize: doc.size }), }); Attachment.allow({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel doc; return true; }, @@ -448,21 +462,21 @@ Attachment.allow({ update: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return true; }, remove: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return true; }, insert: (userId, doc) => { // $ExpectType string userId; - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return true; }, @@ -494,14 +508,14 @@ Attachment.allow({ }, // Can not figure out why we should define manually type of document - transform: (doc: DBAttachment) => ({ fileSize: doc.size }), + transform: (doc: AttachmentDoc) => ({ fileSize: doc.size }), }); Attachment.find({}).observe({ changed: (newDoc, oldDoc) => { - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel newDoc; - // $ExpectType AttachmentDocument + // $ExpectType AttachmentModel oldDoc; return false; }, @@ -511,7 +525,7 @@ Attachment.find( {}, { transform: doc => { - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc doc; return { fileSize: doc.size }; }, @@ -528,9 +542,9 @@ Attachment.find( Attachment.find({}, { transform: null }).observe({ changed: (newDoc, oldDoc) => { - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc newDoc; - // $ExpectType DBAttachment + // $ExpectType AttachmentDoc oldDoc; return false; }, @@ -557,4 +571,4 @@ Attachment.allow({ transform: { foo: 'foo' } }); Attachment.deny({ transform: [] }); // @ts-expect-error -new Mongo.Collection('attachments', { transform: '' }); +new Mongo.Collection('attachments', { transform: '' });