Creating a filter in Revit failedCreating a filter in Revit failed

I want to Add a new filter to Revit using pyrevit but it gives me an error: TypeError: expected ICollection[ElementId], got list
I don’t know where I went wrong. Here is my code:

from Autodesk.Revit.DB import BuiltInCategory, ElementId, ParameterFilterElement, Transaction

from Autodesk.Revit.DB import FilterRule, ParameterFilterRuleFactory

# create list of categories that will be selected for the filter

categories = [ElementId(BuiltInCategory.OST_GenericModel)]

# create a list of rules for the filter

rules = []

family_name_parameter_id = ElementId(BuiltInParameter.SYMBOL_FAMILY_NAME_PARAM)

rules.append(ParameterFilterRuleFactory.CreateEqualsRule(family_name_parameter_id, "BIM-Конфликт", False))

filter = None

# assuming 'doc' and 'view' are already defined

# 'doc' is the current Revit document and 'view' is the view where you want to apply the filter

t = Transaction(doc, "Create and Apply Filter")


filter = ParameterFilterElement.Create(doc, "BIM", categories, rules)


view.SetFilterVisibility(filter.Id, True)


ICollection or List work like this:

from pyrevit.framework import List

# then declare the iCollection
categories = List[DB.ElementId]()
# then add the categories this way

for next time, in discourse, syntx your code wy appending and prepending it with ```
That will help reading it

I can’t import I don’t understand why the error is

a typo from me:
from pyrevit import framework

that’s what happen when I write code from my cellphone ;p