Skip to content

Conversation

@markwpearce
Copy link
Collaborator

@markwpearce markwpearce commented Dec 15, 2025

Adds IntersectionType modelled after TypeScript's intersection types

  • Add IntersectionType
  • Add parsing for <type> and <type>
  • Allow "Grouped types" in parser (eg: (type1 or type2) and (type3 or type4))
  • Update type compatibility and other helpers to work with intersection types
  • Verify scope validation
  • Use order of operations on types, eg. type foo = myType1 or myType2 and myType3 or myType4 => myType1 or (myType2 and myType3) or myType4
  • Make sure type MyKlassAA = MyKlass and roAssociativeArray works properly
  • Test intersections with callfuncs
  • Add docs

@markwpearce markwpearce marked this pull request as ready for review January 12, 2026 20:58
@markwpearce markwpearce added this to the v1.0.0 milestone Jan 13, 2026
@markwpearce
Copy link
Collaborator Author

Accomplishes #1330

@TwitchBronBron TwitchBronBron added the create-package create a temporary npm package on every commit label Jan 20, 2026
@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on 5e648aa. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.49-intersection-type.20260120154200.tgz

Copy link
Member

@TwitchBronBron TwitchBronBron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small things, but overall this looks great!

}
}
if (this.checkAny(TokenKind.And, TokenKind.Or)) {
this.warnIfNotBrighterScriptMode('custom types');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better name than custom types? I know this is configurable, but feels like it would better to say something like intersection or union?

@TwitchBronBron TwitchBronBron enabled auto-merge (squash) January 20, 2026 17:47
@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on d277935. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.49-intersection-type.20260120174746.tgz

Co-authored-by: Bronley Plumb <bronley@gmail.com>
@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on 92a7755. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.49-intersection-type.20260120180333.tgz

@rokucommunity-bot
Copy link
Contributor

Hey there! I just built a new temporary npm package based on db1138c. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.49-intersection-type.20260122131443.tgz

@TwitchBronBron TwitchBronBron merged commit 610607e into v1 Jan 22, 2026
8 checks passed
@TwitchBronBron TwitchBronBron deleted the intersection_type branch January 22, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-package create a temporary npm package on every commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants